Single Choice Not Set

QWhat will be the output?
1. public interface InfA{
2.       protected String getName();
3. }

public class Test implements InfA{
      public String getName(){
            return "test-name";
      }
      public static void main (String[] args){
            Test t = new Test();
            System.out.println(t.getName());
      }
}

ID: #2287 Java Interfaces And Abstract Classes MCQ 2,137 views
Question Info
#2287Q ID
Not SetDifficulty
Java Interfaces And Abstract Classes MCQTopic

Choose the Best Option

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

  • A test-name
  • B Compilation fails due to an error on lines 1
  • C Compilation fails due to an error on lines 2
  • D Compilation succeed but Runtime Exception
Correct Answer

Explanation

Compilation fails due to an error on lines 2

Share This Question

Challenge a friend or share with your study group.