☕ Java Beginner

What does the static keyword mean in Java?

Answer

The static keyword means a member belongs to the class itself rather than to any instance of the class. Static fields are shared across all instances — changing the value in one place changes it for everyone. Static methods can be called without creating an object: Math.sqrt(), Integer.parseInt(). Static methods cannot access instance (non-static) fields or methods directly. A static block (static { }) runs once when the class is first loaded by the JVM, useful for static initialization. Inner classes can also be static — static nested classes do not hold a reference to the enclosing instance.