Java Object Equivalence

This is an update to the subsection “Testing Object Equivalence” in the “Operators” chapter of On Java 8. This will appear in the book in its next update. The relational operators == and != work with all objects, but their results can be confusing:// operators/Equivalence.java public class Equivalence { static void show(String desc, Integer n1, Integer n2) { System.out.println(desc ":"); System.out.printf( "%d==%d %b %b%n", n1, n2, n1 == n2, n1.
 •  0 comments  •  flag
Share on Twitter
Published on February 03, 2021 16:00
No comments have been added yet.


Bruce Eckel's Blog

Bruce Eckel
Bruce Eckel isn't a Goodreads Author (yet), but they do have a blog, so here are some recent posts imported from their feed.
Follow Bruce Eckel's blog with rss.