Problem category: Compile-time Problems
Diagnosis Difficulty: Easy-medium
Difficulty to Fix: Easy
This problem usually occurs when you inherit an abstract class or implement an interface. It can also occur if you forget to declare your class as abstract after you've declared an abstract method.
public abstract class Base { public abstract void doIt(); }
public class Child extends Base { }
Error Messages
In general, these error messages are very indicative of the problem, though their may be many error messages if you have multiple abstract methods.
Child.java:1: Child is not abstract and does not override abstract method doIt()
in Base
public class Child extends Base
in Base
public class Child extends Base
There are two common fixes to this problem. The more common of the two is to implement the methods. The other fix is to declare your class as abstract. Both fixes fulfill different purposes (one is providing an actual implementation for that method, the second only declares that an implementation exists and will be defined by inheriting classes), and you should pick the fix that fits your situation.
Fix 1: Implement the method.
// using the same Base class as above public class Child extends Base { /** * **/ @Override public void doIt() { // sample implementation System.out.println("I did it."); } }
Fix 2: Declare your class abstract.
// using the same Base class as above public abstract class Child extends Base { }