Sail E0 Webinar
Question
What 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());
}
}
Options:
A .  test-name
B .  Compilation fails due to an error on lines 2
C .  Compilation fails due to an error on lines 1
D .  Compilation succeed but Runtime Exception
E .  None of these
Answer: Option B

Submit Your Solution Below and Earn Points !
Next Question

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers