Quiz · Inheritance and polymorphism · lesson 8 of 10
Quiz — new on an abstract class
What happens when this program is compiled and run?
public class Main {
public static void main(String[] args) {
Shape s = new Shape();
System.out.print(s.sides());
System.out.print(s.area());
}
}
abstract class Shape {
int sides() { return 4; }
abstract int area();
}