JavaOne – 10 challenges and eliminate stressful bugs

“Learn the Concepts between these 10 Java Challenges and Eliminate Stressful Bugs”

Speaker: Barry Evans & Rafael Chinelato Del Nero

For more blog posts from JavaOne, see the table of contents

Missed this one. I was late while chatting in the hallway. (and dithering about whether to go to this session of a Jigsaw one)

JVM exits if only daemon threads left. Instance variable not thredsafe. [also don’t know that last thread executes last but didn’t comment on that]

new String() and trim() create objects. == vs equals
[I fell for this. I missed == vs equals]

hashcode and equals
if hashcode always he same, doesn’t help for hashmap. Then only equals matter. Also tricky implementation for hash code to return 7

Crazy Syntax
Fun random syntax. How to obsfucate code.

Sorting and Comparables
TreeSet uses compareTo, not equals or hashcode

default methods don’t count towards single abstract method. Also, interfaces can be private

iterate() is infinite terminal operation so can’t use with forEach. Also, a good reminder to use Comparator.natural order instead of reimplementing when need.

Method Overloading
Widening then autoboxing then varargs.
int and long can “widen” to float.
wrapper class Double goes to Object before double
[I only got this one right because “does not compile” was not a choice”.]
Interesting explanation of about “taking more effort” to use autoboxing/varargs.

Virtual method invocation means doesn’t matter what store variable reference in. Overloading vs overriding #Javachallenge

My take: This was fun! Being a cert book author gave me an advantage but some were still tricky and tough! And using The Simpsons as examples was fun. He did show of hands for each option; most people didn’t raise their hand for any of the choices.

2 thoughts on “JavaOne – 10 challenges and eliminate stressful bugs

Leave a Reply

Your email address will not be published.