-
What is the output of this program?
class N
{
public int K;
protected int L;
}
class M extends N
{
int L;
void display()
{
super.L = 5;
System.out.println(K + " " + L);
}
}
public class Result
{
public static void main(String args[])
{
M object = new M();
object.K=3;
object.L=4;
object.display();
}
}
-
- 1 2
- 2 3
- 3 4
- 4 5
- 5 6
Correct Option: C
Both class N & M have member with same name that is L, member of class M will be called by default if no specifier is used. K contains 3 & L contains 4, printing 3 4.