Computer Applications

Find the error:

Integer obj = new Integer("A"); 
System.out.println(obj);

Java Library Classes

7 Likes

Answer

Integer obj = new Integer("A"); statement will generate NumberFormatException at the time of conversion of String argument "A" to Integer object. The exception is raised because "A" is not a valid string representation of a numeric value, therefore it cannot be converted to Integer object.

Answered By

4 Likes


Related Questions