Static Main Method in Java | Core Java Tutorial

This Core Java Tutorial “Static main method in Java” post explains clearly what is the need of main method and how to define main method in java application.


 

main() method :

  • It is static method.
  • It is used to start java application.
  • JVM invokes implicitly main() method.
  • We must follow complete prototype of main() method.

 

  • Above main method is having empty body.
  • Hence it prints nothing when we run the program.
  • To analyze whether the main method is executing or not, we need to display messages from main method.
  • System.out.println() is used to display messages from blocks or methods.
  • System.out.println() is used in debugging process to analyze the code.

 

 

Share this