Static methods
Static methods symbolize the behavior of entire class. An instance of a class just isn’t required to execute static methods. They are often called using class name.
Syntax:
ClassName.methodName |
Example
class DisplayTest { public static void display(){ System.out.println("Hello World"); } } public class StaticMethodExample { public static void main(String args[]){ DisplayTest.display(); } } |
Output
Hello World |