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