JAVA Programming :: Inheritance - Discussion
Home > JAVA Programming > Inheritance > MCQs Questions Discussion
7 / 9
What is the output for the below code?
public interface InfA {
protected String getName();
}
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());
}
}
public interface InfA {
protected String getName();
}
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());
}
}
Atest-name
BCompilation fails due to an error on lines 2
CCompilation fails due to an error on lines 1
DCompilation succeed but Runtime Exception
Answer: Option (Login/Signup)
Show Explanation
Asked In ::
No Discussion on this question yet!