Home » JAVA Programming » Inheritance » Question
  1. What is the output of this program?

    class N
    {
    int K;
    }
    class M extends N
    {
    int L;
    void display()
    {
    super.K = L + 5;
    System.out.println(K + " " + L);
    }
    }
    public class inheritance_Example
    {
    public static void main(String args[])
    {
    M object = new M();
    object.K=4;
    object.L=3;
    object.display();
    }
    }
    1. 8 3
    2. 4 3
    3. 3 8
    4. 3 4
    5. None of these
Correct Option: A

Output: 8 3



Your comments will be displayed only after manual approval.