☕ Java Beginner

What does the static keyword mean in Java?

Why Interviewers Ask This

Interviewers use this question to quickly assess whether a candidate has the foundational knowledge required for Java development. It reveals whether you understand the building blocks that more complex concepts rely on.

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.

Pro Tip

Demonstrate both theoretical understanding and practical experience. Say what it is, then give an example of how you actually used it in a Java codebase.