File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

equals() method - comparing Objects

 
Kevin Nielsen
Greenhorn
Posts: 8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,

I'm studying for the SCJP 1.5 exam by reading the K&B book and some additional stuff (Sun's JDK 1.5 tutorials + other things).

I'm a bit confused over a statement in the K&B book - page 389 - "Wrappers won't pass equals() if they're in different classes"

...does this also means (like the == operator), that my own objects will fail the test or does this only apply to Wrappers?

Can somebody help on this?

regards,
Kewin
 
Joyce Lee
Ranch Hand
Posts: 1392
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Kewin,

"Wrappers won't pass equals() if they're in different classes"

This statement is explained with a code example on page 384 of K&B.

Here is another example:


Joyce
[ July 27, 2005: Message edited by: Joyce Lee ]
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic