Static Method


public class StaticMethod 
{
    //Static method can be invoked without creating an object and it can access only static members.
    static int i=10;
    public static void display()
    {
        System.out.println("Inside the static method display");
        System.out.println("Value of static member i= "+i);
    }
    public static void main(String[] args
    {
        StaticMethod.display();
    }
}

Output:
Inside the static method display
Value of static member i= 10