SelvarajC Chennappan

Greenhorn
+ Follow
since Aug 20, 2009
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by SelvarajC Chennappan

I dont understand .How Object equals method will be called.Since inteface is not extending Object Class

i.e in java ,interface is also extending Object Class.If yes .Why Lis interface is declared equals and hashCode method.
Thanks Sebastian Janisch
Henceforth will code between the code tags .My question how to call equals method using an interface reference .
Hi,

interface Sample{}
Class A implements Sample{
f(){

sample s = null;
s.equals(this);
}

}
Doubt: Compiler is not reporting any error here.Since interface is not extending an Object class.Why compiler is not reporting an error for equals invocation?.

Regards
Selvaraj C

Jesper Young wrote:Because ArrayList extends AbstractList (which implements List), ArrayList also automatically implements List.

If you look at the source code of ArrayList (in the file src.zip inside your JDK installation directory) you'll see that it explicitly implements interface List. It's not necessary to specify this, because it already implements List via its base class. Probably the people who wrote the ArrayList class just included this for clarity.



Thank you Jesper Young


Could you please explain the clarity, we are getting here?



14 years ago
Hi All,

AbstractList implements List and ArrayList extends AbstractList implements List.

doubt :Why ArrayList is implementing List again?

Regards,
Selvaraj C
14 years ago