Java4teachus

Tuesday, December 18, 2018

Different B/W the Class vs Object In JAVA

Hash code or hexadecimal code:

When we create an object  with new operator by referring internally for created java execution provides a unique numerical id called Hash code / hexa decimal format called hexa decimal code.

The purpose of hash code or hexa decimal code is always used for identifying the objects or provides identity object.

ClassLoaderSubSystem:

A ClassLoaderSubSystem is one of the java program available  as a part of java software and whose job role is to load the .class file from "Secondary Memory into Main Memory". without loading .class file name we cannot create a object.

Class :
  • A Class is collection of  'Data Members & Methods' .
  • The definition of  class does not contain memory space for  Data Members & Methods .
  • Class definition is always consider as  'Logical existence' .
  • When we execute the Java program the definition of class will be loaded once in the in the Main Memory  with the help of "ClassLoaderSubSystem" .
  • When we  write a java program the definition of a class will exists only once .
  • The definition of class resides in Secondary Memory in the form of  class name  .
Class-vs-Object-In-java.jpeg

Object :
  • Instance of a class is caned an  'Object'. 
  • Memory space is created for  Data Member & Methods  only when we create an object 
  • Object creation is always consider as 'physical existence'. 
  • After loading  class file name in the Main Memory  and later we can create the  object  .
  • With respect to one class definition we can create multiple objects 
  • Objects residing in   Main Memory.

Note 

  1. All "Objects " of java resides in the "Heap Memory". 
  2. All "Methods" of java resides & executes in "Stack Memory".
  3. All  "figurative constants"  values (directly used). resides in "Associatine memory" .
  4. All the above three memories are of the parts of "Main Memory" .

No comments:

Post a Comment

Thanks for visiting my site..