Computer Science, asked by gaddammounika093, 4 months ago

(Q-1/10)
What is the output of this program ?
class A {
public int i;
private int j;
}
class B extends A{
void display() {
super.j = super.i + 1;
System.out.println(super.i + super.j);
}
class inheritance {
ho
public static void main(String args[]) {
B obj = new B();
obj.1 = 1;
obj.j = 2;
obj.display();
>
A. Runtime Error
C. Compilation Error
D: 3 3​

Answers

Answered by samarthkrv
0

Answer:

you will get compilation error because the variable j is private and can only be accessed by that class only

Explanation:

Similar questions