Multiple choice

Which of the following statements is wrong?

class superclass

{

}

class subclass extends superclass

{

}

 

  1. superclass superclassref=new superclass();

  2. superclass superclassref=new sublass();

  3. subclass subclassref=new subclass();

  4. subclass subclassref=new superclass();

  5. Any class reference variable cannot reference other class object.

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

It is not possible to reference a super class object with the sub class reference variable.