Question 18
Not yet
answered
Flag
question
What will be the output of this code using multiple levels of abstraction?
abstract class Sport {
}
abstract void play();
abstract class IndividualSport extends Sport {
}
abstract void warmUp();
class Tennis extends IndividualSport {
void play() {
}
System.out.println("Playing tennis");
void warmUp() {
System.out.println("Warming up for tennis");
}
}
public class Main {
public static void main(String[] args) {
Tennis tennis = new Tennis();
tennis.warmUp();
tennis.play();
}
}
O a. Warming up
Playing tennis
O b. The code will throw a runtime error because Sport is abstract.
Oc. Warming up for tennis
Playing tennis
Od. The code will not compile because IndividualSport is abstract.