Static User method in Java | Core Java Tutorials

This Core Java Tutorial “Static User method in Java” post explains clearly what is static method, how to access static method and need of static method in java.


 

Static user method:

  • A block of instructions having identity
  • Method is taking input, processing input & producing output.
  • We must call every method(except main) explicitly using its Identity.

Method Syntax and Example

 

  • Every method should have return type (at least void)
  • Every method must be called explicitly in the application using it’s identity. If we don’t call, method body never executes in the application.
  • Following diagram represent what is the need to calling a method in the application.

Importance of Method Call

 

Output:

  • Every method must be called explicitly.
  • In the above application, JVM invokes only main method implicitly.

 

Output:

 

 

Share this