JAVA Programming :: Inheritance - Discussion
Home > JAVA Programming > Inheritance > MCQs Questions Discussion
10 / 9
What is the output for the below code?
interface A {
public void printValue();
}
public class Test{
public static void main (String[] args){
A a1 = new A() {
public void printValue(){
System.out.println("A");
}
};
a1.printValue();
}
}
interface A {
public void printValue();
}
public class Test{
public static void main (String[] args){
A a1 = new A() {
public void printValue(){
System.out.println("A");
}
};
a1.printValue();
}
}
ACompilation fails due to an error on line 3
BA
CCompilation fails due to an error on line 8
Dnull
Answer: Option (Login/Signup)
Show Explanation
Asked In ::
No Discussion on this question yet!