Pages

Friday 22 November 2013

Difference between Primitive type and Reference type in Java



Primitive type  

Reference type

1. It is predefined in any programming language.

1.It is predefined as well as user-defined in Object oriented language.
2. It is used to store value may be integer, decimal , floating or boolean.

2.It is used to store the reference value of the object and is of integer type.

3.Size of the primitive type are varies according to the type. 

3. Reference type has fixed size of 8 Byte.


4.It doesn't point to any object as it simply stores the required value.

4. It always points to the
corresponding object whose address is stored as a reference value. 

5. int, float,char,short,byte etc are the example of primitive type
5. String, Array,Class, interface are the examples of reference type.

No comments:

Post a Comment