Monday 16 March 2015

Q 14) Difference Between Static And Instance Variables ?




Static Variables
Instance Variables
01)
Static keyword is used in front of the variable.
Variables without static keywords are known as non static or Instance variables.
02)
JVM allocates memory at
 “ CLASS LOADING TIME”
JVM allocates memory of Instance variables at  
“ OBJECT CREATION TIME “
03)
Only one copy of static variables will be allocated for a number of objects in a class.
Number of memory blocks will be allocated with respect to number of objects.


No comments:

Post a Comment