Rules for Abstract Methods in Java
Fast recall
Quick revision
Core answer
default, static, or private are abstract. An abstract method cannot be private, static, or final. A concrete class must provide or inherit an implementation for every abstract method in its type hierarchy.Whether you know the exact legality rules for abstract methods, especially the modifier combinations that are illegal.
Thinking an abstract method can be private/static/final, or that you can put an abstract method in a regular (non-abstract) class.
Explain the why: each forbidden modifier (private, static, final) defeats overriding, which is the whole point of an abstract method.
Interview-ready guide
Interview answer
An abstract method is just a signature with no body — it ends in a semicolon and forces whichever subclass extends the class to supply the real implementation. It can only live in an abstract class or an interface, never a regular concrete class.
The contract is simple: the first concrete subclass has to implement every abstract method it inherits, or it stays abstract itself and passes the job down the chain.
The part worth nailing is the three modifiers that never compile on it, and they all fail for one root reason — each kills overriding:
privatehides it from subclasses,staticisn't polymorphically overridden,finaloutright forbids overriding.
Explaining that they share one root cause, rather than just reciting them, is what shows you understand the mechanism. And in an interface, methods are public abstract by default, so you skip both keywords.
Rules for Abstract Methods in Java
Direct Answer
An abstract method declares a signature without a body. It may be declared in an abstract class, and interface instance methods without default, static, or private are abstract. An abstract method cannot be private, static, or final. A concrete class must provide or inherit an implementation for every abstract method in its type hierarchy.
Code Example
abstract class Shape {
// ── Legal abstract methods ─────────────────────────────────────
public abstract double area(); // legal: public + abstract
protected abstract String describe(); // legal: protected + abstract
abstract void draw(); // legal: package-private + abstract
// ── Illegal abstract methods ───────────────────────────────────
// private abstract void log(); // ILLEGAL: private — subclass can't see it
// static abstract void create(); // ILLEGAL: static — not overridable
// final abstract void lock(); // ILLEGAL: final — explicitly forbids override
// ── Body on abstract method is illegal ─────────────────────────
// abstract double area() { return 0; } // ILLEGAL: abstract method must have no body
}
// ── Concrete subclass MUST implement every abstract method ──────────
class Circle extends Shape {
private final double radius;
Circle(double radius) { this.radius = radius; }
@Override
public double area() { return Math.PI * radius * radius; } // must implement
@Override
protected String describe() { return "Circle r=" + radius; } // must implement
@Override
void draw() { System.out.println("Drawing circle"); } // must implement
}
// ── Partial subclass must itself be abstract ───────────────────────
abstract class PartialShape extends Shape {
@Override
public double area() { return 0; } // implements area() only
// describe() and draw() still abstract → class must be abstract
}
Common Mistakes & Pitfalls
- Thinking
private abstractis legal —privatehides the method from subclasses so it can never be overridden, and a method that can't be overridden defeats the whole point; the compiler rejects it. - Assuming
static abstractworks — static methods belong to the class and are hidden, not polymorphically overridden, so the combination won't compile. - Marking an abstract method
final—finalexplicitly forbids overriding, the exact opposite of whatabstractrequires; the two keywords cancel each other out. - Putting an abstract method in a concrete class — the class itself must be declared
abstract, or the compiler errors; you can't sneak a body-less method into a regular class.
Check your understanding
Answer these without looking back at the article.
- What happens if a subclass doesn't implement all abstract methods?
- Can an abstract class have no abstract methods?
- Can an interface method be abstract and default at the same time?
Looking for a structured roadmap?
Every module on this page is also part of the full Java backend interview track.