Static/ Non-static Methods

Non-static methods requires an instance of a class where as static methods can be directly called with class name. Limitation of static methods is that it can access only static class variables.
The source code file name should be the name of the class in which public static void main(String [] args) is there, so that the JVM can directly call it with the .main().
Method Variable can not be static because the scope is within the method.
Every object is not a instance but every instance is an object. Object has no memory location but instance has. Instance has copy of that class. In Java every class has instance other than String.

class a                               Output :
{                                        10
    int x=10;                        20
    void met1()
    {
        System.out.println(x);
    }
}
class b
{
     //int y = 20;        
    //this will give compile error non-static variable cannot be referenced from static context   
    static int y=20;
    static void met2()
    {
        System.out.println(y);
    }
}
class StaticMethodTest
{
    public static void main(String args[])
    {
        a m=new a();
        m.met1();
        b.met2();
    }
}