Static Method

Woman in cafe working on laptop
Michael H./Digital Vision/Getty Images

Normally you can't call a method of a class without first creating an instance of that class. By declaring a method using the static keyword, you can call it without first creating an object because it becomes a class method (i.e. a method that belongs to a class rather than an object).

Static methods are used for methods that do not need to access to an object's state or only use static fields. For example, the main method is a static method:

public static void main(String[] args)

It is the starting point for a Java application and does not need to access an object's state. In fact, there aren't any objects created at this point. Any parameters that it needs can be passed as a String array.

To find out more about using the static keyword have a look at Static Fields.