static variable in Java

Java has no static global variable, or static local variable, so only has class variable.
A static variable belongs to the class and it will be loaded into the memory along with the class. See class variable in Java.
The variables with in a method are local variables and their scope lies within the method and they get destroyed after the method execution. i.e. you cannot use a local variable outside the current method which contradicts with the definition of class/static variable. Therefore, declaring a static variable inside a method makes no sense, if you still try to do so, a compile time error will be generated.