PRO192_-_SP_2025_-_Block_5_-_1_3854.webp
M

PRO192_-_SP_2025_-_Block_5_-_1_3854.webp

Kizspy Question: 29
(Choose 1 answer)
What will be the output of the following Java code?
class A {
int a = 5;
public int getA() {
return a;
}//class A
class B extends A {
private int a = 6;
public void rollBackA() {
a++;
a = super.getA();
} //class B
public class Main {
public static void main(String[] args) {
A objA = new A();
B objB =new B();
objB.rollBackA();
System.out.format("%d, %d %n", objA.getA(),objB.getA());
A. 55
B. 6,6
C. 5,6
D. 6,5

Thông tin

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

Share this media

Back
Bên trên Bottom