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[0]).doubleValue(); equals: double d4 = new Double(args[0]).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