1public class stringtodouble {
2 public static void main(String args) {
3 String string = "1.23";
4 double decimal = Double.parseDouble(string);
5 }
6}
1try {
2 a = Double.parseDouble(b);
3} catch (NumberFormatException e) {
4 //the parseDouble failed and you need to handle it here
5}