Franz-kun Franz-kun - 1 year ago 197
Java Question

Class must either be declared abstract or implement abstract method: Intellij error?

I made an abstract class

public abstract class AuraSensei {
abstract boolean has();

but i'm getting error (see above); need to implement abstract method. thats exactly what I think I did in this code.

public class MariaAura extends AuraSensei {
boolean has() {
return false;

is this IDE INTELLIJ IDEA fault or am I just being stupid? How can I fix this?

Answer Source

If you're going to be implementing your abstract method in another package, it needs to be protected so it's visible to the subclass. Otherwise, it's as if you're declaring a separate method without overriding the abstract one.

This is one reason why you should always mark method overrides with the @Override annotation.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download