Computers

University

Image

Inheritance

302
plays

10 questions

Show Answers
See Preview
  • 1. Multiple Choice
    45 seconds
    1 pt

    Which of this keyword must be used to inherit a class?

    super

    this

    extends

    extent

  • 2. Multiple Choice
    1 minute
    1 pt

    A class member declared protected becomes a member of subclass of which type?

    public member

    private member

    protected member

    static member

  • 3. Multiple Choice
    1 minute
    1 pt

    class A

    {

    int i;

    void display()

    {

    System.out.println(i);

    }

    }

    class B extends A

    {

    int j;

    void display()

    {

    System.out.println(j);

    }

    }

    class inheritance_demo

    {

    public static void main(String args[])

    {

    B obj = new B();

    obj.i=1;

    obj.j=2;

    obj.display();

    }

    }

    0

    1

    2

    Compilation Error

  • Answer choices
    Tags
    Answer choices
    Tags

    Explore all questions with a free account

    Already have an account?