Single Choice Not Set

QWhat will be the output?
class Parent{
      public void method(){
            System.out.println("Hi i am parent");
      }
}
public class Child extends Parent{
      protected void method(){
            System.out.println("Hi i am Child");
      }
      public static void main(String args[]){
            Child child = new Child();
            child.method();
      }
}

ID: #2260 Inheritance in Java MCQ 2,348 views
Question Info
#2260Q ID
Not SetDifficulty
Inheritance in Java MCQTopic

Choose the Best Option

Click any option to instantly check if you're correct.

  • A Compiles successfully and print
  • B Compiles successfully and print
  • C Compile time error
  • D Run Time error
Correct Answer

Explanation

Compile time error

Share This Question

Challenge a friend or share with your study group.