Object Reference Variable in Java | Java Training

This Java Training”Object Reference Variable in Java” post explains clearly what is Object reference variable and how constructor returns reference of Object and much more.


How to access non-static members from non static context?
Using ‘this’ keyword.


How to access non-static members from static context?
Using “Object reference variable.


What is Object Reference Variable?

  • It is a variable of Class type.
  • It holds Object address.
  • Constructor doesn’t have any return type in it’s definition
  • Constructor implicitly returns address of Object after its creation.
  • We must collect address into “class type variable”
  • Class is called User defined data type.

Object Reference Variable in Java


Program that Print Object address using Object reference variable in Static context:


Share this