Computer Science, asked by ashuiihm, 8 months ago

int a=5,b=6;
System.out.print ((a<b)?a+10:b+10);
Select correct output:-
25
26
15
16​

Answers

Answered by Anonymous
0

Answer:

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 {

public static void main(String args[])

{

B obj = new B();

obj.i = 1;

obj.j = 2;

obj.display();

}

}

a) 2 2

b) 3 3

c) Runtime Error

d) Compilation Error

Answer: d

Explanation: Class A contains a private member variable j, this cannot be inherited by subclass B. So in class B we can not access j. So it will give a compile time error.

Similar questions