JavaBeginner#fundamentals

What is the difference between static and instance methods?

Static methods belong to the class and can be called without an object instance; they cannot access instance (non-static) fields directly. Instance methods operate on an object's state and require an instance to invoke.

Example
class MathUtil { static int square(int x) { return x*x; } }
MathUtil.square(5); // no instance needed, returns 25

Related Questions

1
JavaBeginner#oop

What is a constructor and how does constructor overloading work?

Open
2
JavaIntermediate#oop

What is the difference between instance initializer blocks and constructors?

Open
3
JavaBeginner#object#fundamentals

What is the difference between == and equals() when comparing objects that don't override equals()?

Open