-
What is the output of this program?
class N
{
public int K;
public int L;
N()
{
K = 5;
L = 6;
}
}
class M extends N
{
int p;
M()
{
super();
}
}
public class super_Example
{
public static void main(String args[])
{
M object = new M();
System.out.println(object.K + " " + object.L);
}
}
-
- 5 6
- 6 5
- Compilation Error
- Runtime Error
- None of these
Correct Option: A
Keyword super is used to call constructor of class N by constructor of class M. Constructor of a initializes K & L to 5 & 6 respectively.