Tuesday 7 May 2013

Difference Between Class and Object in Java?

Definition of class:- Class is a collection of data members and associated methods.

Definition of object:- Blue print of class is known as object

 

Different between class and object is follow


                    Class
                       Object
1.The process of binding the data member
 and associated methods. In a single unit
  is known as class.
1. Class variable is known as object.
2. Whenever we defined a class we never get any amount of memory space for the data members of class.
2. Whenever we create an object we get the memory space for the data member of a class.
3. Class will have logical existence.
3. Object will have physical existence.
4. Class will be loader first by class. Loader subsystem from secondary memory to primary memory.
4. After loading the class .In main memory object creation will taken place.




All the object of Java resides in heap memory (in general which ever languages follow dynamic memory location whose object resides in heap memory).

All the methods of all the programming languages executes in Stack memory.

All the constants values of all programming languages reside in Associative memory.

Heap memory, Stack memory and Associative memory are the parts of main memory.

0 comments:

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More