Static Members in Java | Java Tutorials

This Java Tutorials “Static Members in Java” post giving introduction to static members in java application with diagrammatic explanation.


 

Static Members:

  • Common functionality of Java application must be defined as static.
  • Static members we can access directly by using class name.
  • Java supports 4 static members.
  1. Static main method
  2. Static block
  3. Static user method
  4. Static variable

 

  • In java we can save java source file with any name.
  • We need to compile the program with source file name.
  • After compilation, class file will be generated with the defined class name.

  • Compiler takes care of syntactical errors only.
  • Compiler never checks main method is present or not.
  • JVM invokes main method to start application execution.

 

Share this