You might have used the keyword static in Java several times, let us now understand the use of it. In the Java language, a static keyword is implemented to make a class-level variable. Hence variables and methods having the static keyword act as part of the class and not as the class instance.
static keyword can be used with a variable of any class. These types of variables do not belong to the object (or you can call it an instance of your class). As the static variables get shared in all instances; hence, they are not treated as thread-safe.
Like that of static variables, static methods also have the same property, i.e., they do not belong to the instance of the class. They have one additional property, which is, they can not access all variables, but variables declared as static only. Also, they are restricted to invoking static class methods only. Static methods are prominently used in Java Wrapper classes and Utility classes.