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.
Hello, in the following code I present two ways of converting Strings to double primitives Either by pareDouble or valueOf() in combination with wrapper class Double. Why is it possible to omit „valueOf()“ method: double d2 = Double.valueOf(args).doubleValue(); equals: double d4 = new Double(args).doubleValue(); so why do we need „valueOf()“ method?
The Double.valueOf() (and Double.copyValueOf()) methods are class (static) methods. So doing double trouble = Double.valueOf("2.71828"); is kinda convenient for going from a String (or whatever valueOf() likes) to a primitive double variable. -Barry