public abstract class Shape {
public abstract double area();
}
public class Circle extends Shape {
private double r;
public Circle(double radius) { r = radius; }
// no area method defined
}What is the result of compiling Circle?
- A
Compiles fine; area() returns 0
- B
Compiles but throws RuntimeException
- Ccheck_circle
Compile error: Circle must implement area() or be declared abstract
- D
Compiles only with a warning
Explanation
A non-abstract subclass of an abstract class must implement all inherited abstract methods. Circle does not implement area(), so it must either implement it or be declared abstract.