Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Something that goes in a cup. Only this time, the value is a remote control.
Primitive Variable
byte x = 7;
The bits representing 7 go into the variable. (00000111).
Reference Variable
Dog myDog = new Dog();
The bits representing a way to get to the Dog object go into the variable.
The Dog object itself does not go into the variable!
With primitive variables, the value of the variable is... the value (5, -26.7, ‘a’).
With reference variables, the value of the variable is... bits representing a way to get to a specific object.
You don’t know (or care) how any particular JVM implements object references. Sure, they might be a pointer to a pointer to... but even if you know, you still can’t use the bits for anything other than accessing an object.