PRO192_-_QUIZ2_-_SL4_3930.webp
Hữu Vinh

PRO192_-_QUIZ2_-_SL4_3930.webp

Question 9
Not yet
answered
Flag question
What will be the output of the following code involving abstract classes?
abstract class Athlete {
abstract void train();
void rest() {
}
System.out.println("Athlete is resting");
}
class Boxer extends Athlete {
void train() {
System.out.println("Boxer is training");
}
}
public class Main {
public static void main(String[] args) {
Athlete athlete = new Boxer();
athlete.train();
athlete.rest();
}
}
○ A. The code will throw a runtime error because Athlete is abstract.
O B. Boxer is training
Boxer is resting
OC. Boxer is training
Athlete is resting
D. The code will not compile because Boxer doesn't implement all abstract methods.

Thông tin

Category
PRO192
Thêm bởi
Hữu Vinh
Ngày thêm
Lượt xem
415
Lượt bình luận
2
Rating
0.00 star(s) 0 đánh giá

Share this media

Back
Bên trên Bottom