I have a problem. I have String
with the value "$615.00"
and I want to convert it to double
or int
.
I have tried the following code but there is an error:
String one = "$615.00";
String two = "$15.00";
double newone = Double.parseDouble( one );
double newtwo = Double.parseDouble( two );
System.out.println(newone-newtwo);
The error is
Exception in thread "main" java.lang.NumberFormatException: For input string: "$615.00"
But I have added the NumberFormatException
for the method and still got the error.