i define an interface say "diskable "as follow .
public void show();
public boolean equals(Object());
here show method is its own method and in front of equals method it add override notation which mean this method is overided from java.lang.Object. How this can be possible when an interface can not extend any class how it can override its method. Intersting thing is if i define "interface diskable extends Object" it shows expected error(interface expected) then why this is saying equals method is overrided from java.lang.Objecct
You can't write interface diskable extends Object because Object is a class. Interfaces can only extend other interfaces.
That said, it still makes sense for @Override to be there. Think about this from the point of view of a class that implements diskable. That class needs to implement equals() becuase it is in the interface. And for that class, the method IS overridden from Object.
Note that in Java, convention is for class and interface names to begin with uppercase. Consider writing Diskable to develop good habits.
Jeanne Boyarsky wrote:Abhishek,
Thank you Boyarsky for your suggestioon i will take care of naming convention from now but i still did not get your point.. when An interface can not extends Object then what is the sense overriding of method from that class.