Difference between Static vs non Static method in Java

One of the key difference between a static and a non-static method is that static method belongs to a class while non-static method belongs to the instance. This means you can call a static method without creating any instance of the class by just using the name of the class e.g. Math.random() for creating random numbers in Java. Often utility methods which don't use the member variables of the class are declared static. On the other hand, you need an instance of the class to call a non-static method in Java. You cannot call it without creating an object because they are dependent upon the member variables which has different values for different instances.  One more important difference between the static and non-static method is that you cannot use a non-static member variable inside a static method, you cannot even call a non-static method from the static method, but the opposite is true e.g. you can call a static function from a non-static method in Java.
Read more »