This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
A colleague just got burned with a misleadingly named method in the java.lang.Long class
Here's a quiz: What would be the value assigned to the variable longVar in the following code snip?
If, like us, you thought it converts the given String into a Long value and returns it, giving the Long value 42L then you're wrong. Here's what the JavaDoc for that method has to say for itself:
public static Long getLong(String nm)
Determines the long value of the system property with the specified name.
It looks up a System property! I would have never thought that in a million years. All I can say is thank goodness for Unit Tests or we'd have most likely let that little nugget of future pain slip through the net.
There's no question here, just sharing an experience.