What is the result?
A.
tolting cantering tolting
B.
cantering cantering cantering
C.
compilation fails
D.
an exception is thrown at runtime
Explanation:
Compiler says: Cannot reduce the visibility of the inherited method from Rideable. müssen
PUBLIC sein
public String ride() { return “cantering “; }
public String ride() { return “tolting “; }
if this is given then the result would be:
A : tolting cantering tolting
A
wow how can you choose A? Compilations fails because methods in interfaces are implicit public abstract so the method of horse should be public String ride(){…….}.
C, line 5 should be
public String ride(){return “cantering”;}