?
What will be the output?
What will be the output?
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());
}
}
Answer & Solution
Correct Answer:
Option
B
Illegal modifier for the interface method InfA.getName(); only public and abstracts are permitted.
Join the Discussion
Login to post a comment or share your explanation.
Login