jQuery in Action, 2nd edition*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Can anybody give an example for this.... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Can anybody give an example for this...." Watch "Can anybody give an example for this...." New topic
Author

Can anybody give an example for this....

Manoj Mani
Ranch Hand

Joined: Mar 31, 2007
Posts: 65
b.eqials(c) can return false even if c.equals(b) returns true.


Impossible Is Often Untried.Its Time For Us To Change....
Chandra Bhatt
Ranch Hand

Joined: Feb 28, 2007
Posts: 1707
Hi Manoj,

Don't you think, it violates the symmetric contract of the equals() method.



What is symmetric contract?
For any reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.




Regards,
cmbhatt


cmbhatt
Manoj Mani
Ranch Hand

Joined: Mar 31, 2007
Posts: 65
Ya thats right?But......

Given that b and c refer to instances of wrapper classes, which two statements are true? (Choose two)
A. b.equals(b) returns true.
B. b.equals(c) returns the same result as b == c.
C. b.eqials(c) can return false even if c.equals(b) returns true.
D. b.equals(c) throws an exception if b and c are different wrapper types.
E. b.equals(c) returns false if the type of wrapper objects being compared are different.

Answer: B, C

Thats why i asked......
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Can anybody give an example for this....