naved momin wrote:what i understand is ...
if JVM is 32bit , reference variable is of 4bytes since (8*4=32bit)
if JVM is 64bit , reference variable is of 8bytes since (8*8=64bit)
It's not that simple. The Java Language Specification and the Java Virtual Machine Specification don't specify what the size of a reference is. That is left up to the particular implementation of the JVM. It's not something you normally need to know when you write software in Java.
On Oracle's JVM, it's not as simple as 4 bytes on 32-bit and 8 bytes on 64-bit. One of the optimizations that Oracle's JVM has is compressed pointers; which means that under certain circumstances, references on the 64-bit JVM are only 4 bytes, not 8 bytes. You can find some more details on that here:
Java HotSpotâ„¢ Virtual Machine Performance Enhancements. This is definitely not a beginner's subject, and definitely not something that you need to know unless you're working on the low-level details of the JVM.