KnowledgeBoat Logo
|
LoginJOIN NOW

Computer Applications

Find the error :

double n2 = Double.parseDouble("2"); 
double n3 = Double.parseDouble("OCA"); 
System.out.println(n2 + " " + n3);

Java Library Classes

4 Likes

Answer

double n3 = Double.parseDouble("OCA"); statement will generate NumberFormatException at the time of conversion of String argument "OCA" to double data type. The exception is raised because "OCA" is not a valid string representation of a numeric value, therefore it cannot be converted to Integer object.

Answered By

3 Likes


Related Questions