programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
• Campbell Ritchie
• Tim Cooke
• Devaka Cooray
• Ron McLeod
• Jeanne Boyarsky
Sheriffs:
• Liutauras Vilda
• paul wheaton
• Junilu Lacar
Saloon Keepers:
• Tim Moores
• Stephan van Hulst
• Piet Souris
• Carey Brown
• Tim Holloway
Bartenders:
• Martijn Verburg
• Frits Walraven
• Himai Minh

# Preparing for this exam - Use images to retain facts

Author
Posts: 375
22
• 1
• Number of slices to send:
Optional 'thank-you' note:
A picture is worth a thousand words. Images help to retain facts.
Here's an example.

Method equals() defines an elaborate contract (set of rules), as follows (straight from the Java API documentation):

• 1 It’s reflexive—For any non-null reference value x, x.equals(x) should return true. This rule states that an object should be equal to itself, which is reasonable.
• 2 It’s symmetric—For any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true. This rule states that two objects should be comparable to each other in the same way.
• 3 It’s transitive—For any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true. This rule states that while comparing objects, you shouldn’t selectively compare the values based on the type of an object.
• 4 It’s consistent—For any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified. This rule states that method equals() should rely on the value of instance variables that can be accessed from the memory and shouldn’t try to rely on values like the IP address of a system, which may be assigned a separate value upon reconnection to a network.
• 5 For any non-null reference value x, x.equals(null) should return false. This rule states that a non-null object can never be equal to null.

• Do you think the following image would help you to retain the preceding set of rules in the exam?

Just scribble when you work with any topic while preparing for your exam. In the exam, you'll be able to recall those points with ease.

With much respect,
Mala

Sheriff
Posts: 9697
43
• Number of slices to send:
Optional 'thank-you' note:
This is an excellent representation of the concept

Although the "we'll always love each other" might not apply very well on humans

Mala Gupta
Author
Posts: 375
22
• Number of slices to send:
Optional 'thank-you' note:
Thanks, Ankit.

Ankit Garg wrote:Although the "we'll always love each other" might not apply very well on humans

Ha.. ha.. I agree. How about robots? But then they won't love each other!

With much respect,
Mala

Ankit Garg
Sheriff
Posts: 9697
43
• Number of slices to send:
Optional 'thank-you' note:

Mala Gupta wrote:

Ankit Garg wrote:Although the "we'll always love each other" might not apply very well on humans

Ha.. ha.. I agree. How about robots? But then they won't love each other!

Actually after I wrote that, I contradicted with my own statement. "we'll always love each other" statement should be "we'll always love each other, if you don't change" (as per the equals method contract). So the statement is true for humans too (as long as they don't change). But people change, so it's a paradox I guess

 These are the worst of times and these are the best of times. And this is the best tiny ad: the value of filler advertising in 2021 https://coderanch.com/t/730886/filler-advertising