About 60 results
Open links in new tab
  1. Convert String to double in Java - Stack Overflow

    Apr 24, 2011 · You can just assign a Double to a double from Java 5 onward thanks to autoboxing / unboxing. Related: What is difference between Double.parseDouble (string) and Double.valueOf …

  2. java - How to check that a string is parseable to a double? - Stack ...

    Is there a native way (preferably without implementing your own method) to check that a string is parseable with Double.parseDouble()?

  3. java - What is the difference between Double.parseDouble (String) and ...

    May 14, 2012 · I want to convert String to a Double data type. I do not know if I should use parseDouble or valueOf. What is the difference between these two methods?

  4. java - Double.valueOf (s) vs. Double.parseDouble - Stack Overflow

    Aug 31, 2011 · parseDouble() returns a primitive double value. valueOf() returns an instance of the wrapper class Double. Before Java 5 introduced autoboxing, that was a very significant difference …

  5. Best way to parseDouble with comma as decimal separator?

    Because of the comma used as the decimal separator, this code throws a NumberFormatException: String p="1,234"; Double d=Double.valueOf(p); System.out.println(d); Is there a better …

  6. Double.Parse double method in java didn't work - Stack Overflow

    Feb 25, 2023 · Since the parseDouble method accepts a String argument, you cannot pass an int value as an argument. If you pass an int value for the parseDouble method, you will get the error: …

  7. java - What is Double.parseDouble (String) and what is the difference ...

    Jan 27, 2018 · The basic difference is that parseDouble() returns a double which is a primitive data type while valueOf() returns an object of Double which is a wrapper class.

  8. arrays - Java: Parsing a string to a double - Stack Overflow

    Sep 17, 2009 · 1 Double.parseDouble() like all parse* methods do not react well to characters that they don't expect, and that - unfortunately - includes white space. A few spaces in your string can ruin …

  9. java - Difference in behaviour between Double.parseDouble and …

    Double.parseDouble: Returns a new double initialized to the value represented by the specified String, as performed by the valueOf method of class Double. Double.valueOf: Leading and trailing …

  10. java - Shorter way to check for null with parseDouble? - Stack Overflow

    amountStr is a value that occasionally contains a double value represented as a string. I want to use Double.parseDouble to read it into a double variable: amountDbl. this.amountDbl = Double.