interface Data {
public void load();
abstract class Info {
public abstract void load();

public class Employee extends Info implements Data {
public void load (){
System.out.println ("loading");
/*do something*/

Why this code is correct ? Is it is not compulsory to deine the method declared in interface by the class which implements that interface ??

Recommended Answers

All 2 Replies

Congratulations on a really interesting question!
I think the answer is that the load() method (line 9) satisfies both the requirements of the interface and the abstract superclass, so that's OK.

indeed. same signature, same name ...
I can't think of a single reason why the code shouldn't compile.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.