1.

What is the output of this program?

class N
{
int K;
void display()
{
System.out.println(K);
}
}
class M extends N
{
int L;
void display()
{
System.out.println(L);
}
}
public class MethodOverriding
{
public static void main(String args[])
{
M object = new M();
object.K=6;
object.L=5;
object.display();
}
}

A. 6
B. 5
C. Compilation Error
D. Runtime Error
E. None of these
Answer» C. Compilation Error


Discussion

No Comment Found

Related MCQs