Single Choice Not Set

QWhat is the output for the below code ?
interface A{
      public void printValue();
}

1. public class Test{
2.       public static void main (String[] args){
3.             A a1 = new A(){
4.                          public void printValue(){
5.                                System.out.println("A");
6.                          }
7.                    };
8.             a1.printValue();
9.       }
10. }

ID: #2286 Java Interfaces And Abstract Classes MCQ 1,218 views
Question Info
#2286Q ID
Not SetDifficulty
Java Interfaces And Abstract Classes MCQTopic

Choose the Best Option

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

  • A Compilation fails due to an error on line 3
  • B A
  • C Compilation fails due to an error on line 8
  • D null
Correct Answer

Explanation

A

Share This Question

Challenge a friend or share with your study group.