PRO192_-_SP_2024_-_Block_5_-_FE_1921.webp
K

PRO192_-_SP_2024_-_Block_5_-_FE_1921.webp

Multiple Choices
Answer (Choose 1 answer)
Given the following Java code:
class A {
void dojob1() {}
}
// 1
class B extends A { void dojob2() {}}//2
//3
class Robot {
//4
public static void main(String[] args){//6
A a1 = new A();
A a2 = new B();
B b1 = new B();
// insert some code here
117
//8
}
// 10
//11
//5
//9
//--
Which of the following, inserted at line 9, will compile?
A. a2.dojob2();
B. (B)a2.dojob2();
C. ((B)a2).dojob2();
D. None of the above statements will compile

Thông tin

Category
PRO192
Thêm bởi
Kurourushi89
Ngày thêm
Lượt xem
4,711
Lượt bình luận
17
Rating
0.00 star(s) 0 đánh giá

Share this media

Back
Bên trên Bottom