aspose file tools
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
Register / Login


JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Reply 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://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Can anybody give an example for this....
 
Similar Threads
error in Marcus Green 2.
Private methods
Can the color for the disabled item be changed
WA #1.....word association
URGENT - NEED HELP - Block Code