The Java programming language is designed to be object-oriented.
 
So what is object orientation?
 
It is the way parts of the application are designed and communicate. Previously,when someone wrote some programming code,it was jumping all around the place and was very difficult to make changes. By designing an application from objects,each object is self contained and has a special way of communicating with another.
 
The benefits of object orientation include:

    * better reusability
    * cleaner design
    * each module (object) carries out specific tasks
    * an object can relate to real world things - for example,a customer       object

Each Java object has state (internal data),behavior (operations or methods) and communicates with each other objects by sending messages. Among them,state is stored in variables and behavior is implemented by methods.
 
Classes and Objects are different
A class is like a cookie cutter and an object is the cookies produced. The class is the template for creating an object. The object is an instance of the class
Class definition
class CookieClass {
}
Make an object (myCookie) reference to a class CookieClass
CookieClass myCookie;
Use the new operator to make an instance of the CookieClass class
myCookie = new CookieClass () ;The Java programming language is designed to be object-oriented.

 

So what is object orientation?

 

It is the way parts of the application are designed and communicate. Previously,when someone wrote some programming code,it was jumping all around the place and was very difficult to make changes. By designing an application from objects,each object is self contained and has a special way of communicating with another.

 

The benefits of object orientation include:



  • better reusability



  • cleaner design



  • each module (object) carries out specific tasks



  • an object can relate to real world things - for example,a customer object



 

 

Each Java object has state (internal data),behavior (operations or methods) and communicates with each other objects by sending messages. Among them,state is stored in variables and behavior is implemented by methods.

 


Classes and Objects are different


A class is like a cookie cutter and an object is the cookies produced. The class is the template for creating an object. The object is an instance of the class



Class definition


class CookieClass {
}



Make an object (myCookie) reference to a class CookieClass


CookieClass myCookie;


Use the new operator to make an instance of the CookieClass class


myCookie = new CookieClass () ;



                    

Copyright © 2010 VisualBuilder. All rights reserved