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 | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies 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....
 
Similar Threads
error in Marcus Green 2.
URGENT - NEED HELP - Block Code
Private methods
WA #1.....word association
Can the color for the disabled item be changed