Download code and documents from GFG.zip
c:\ece538>java GFG Exception: java.lang.NumberFormatException: empty String c:\ece538>java GFG 120 Value = 120.0 c:\ece538>java GFG 120Meg Exception: java.lang.NumberFormatException: For input string: "120Meg" c:\ece538>java GFG A5 Exception: java.lang.NumberFormatException: For input string: "A5" |
GFG.javaclass GFG {
// Driver method
public static void main(String[] args)
{
try {
String str = "";
if (args.length>0) str = args[0];
// returns the double value
// represented by the string argument
double val = Double.parseDouble(str);
// prints the double value
System.out.println("Value = " + val);
}
catch (Exception e) {
System.out.println("Exception: " + e);
}
}
}
Maintained by John Loomis, updated Fri Jan 24 12:39:23 2020