To convert
String
to double
in Java, use Double.parseDouble
.Here's how you do it:
String string = "1.234";
double doubleFromString = Double.parseDouble(string);
System.out.println(doubleFromString); // 1.234