This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates 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.