What is the result?

Given:

What is the result?

Given:

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



Leave a Reply 3

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


karim Ali

karim Ali

A

ddd

ddd

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(){…….}.

aaa

aaa

C, line 5 should be
public String ride(){return “cantering”;}