Static Object reference variable in Java | Java Concepts

This Java Concepts”Static Object reference variable in Java” post explains clearly how to create object directly in the declaration of static variable and how to access from different areas of class.


 

Static Object Reference Variable:

  • We can create object directly in the declaration of static variable.
  • Static variables can be access using class name.
  • We can access static variable anywhere in the application.

 

  • We can create object inside block or method and can be assigned to static variable.
  • While assigning we need to access static variable using class name.
  • Object reference variable stores address. Hence it is called internal pointer variable.
  • Default value of pointer variable in ‘null’.

 

Share this