Question 10
Back to Exercise
The program below does not compile. Which statement correctly describes the problem?
abstract class Shape {
abstract static double unitArea();
}
public class Main {
public static void main(String[] args) {
System.out.println("shapes");
}
}
- A Shape must be an interface
- B A method cannot be both abstract and static: static methods are not overridden, so an abstract one could never be implemented Correct
- C double cannot be returned
- D Abstract classes cannot have methods
Correct Answer: Option B
javac: "illegal combination of modifiers: abstract and static".
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!