Exception occurs with such string on :
Integer.valueOf
Long.ValueOf
Short.ValueOf
No problem:
Double.valueOf
Float.valueOf
Sample program:
public class test2{
public static void main(String aa[]){
Double doubleValue;
Float floatValue;
Integer integerValue;
Long longValue;
Short shortValue;
doubleValue = Double.valueOf("+3.21"); // OK
floatValue = Float.valueOf("+3.21"); // OK
integerValue = Integer.valueOf("+321"); // NumberFormatException
longValue = Long.valueOf("+321"); // NumberFormatException
shortValue = Short.valueOf("+321"); // NumberFormatException
}
}
Integer.valueOf
Long.ValueOf
Short.ValueOf
No problem:
Double.valueOf
Float.valueOf
Sample program:
public class test2{
public static void main(String aa[]){
Double doubleValue;
Float floatValue;
Integer integerValue;
Long longValue;
Short shortValue;
doubleValue = Double.valueOf("+3.21"); // OK
floatValue = Float.valueOf("+3.21"); // OK
integerValue = Integer.valueOf("+321"); // NumberFormatException
longValue = Long.valueOf("+321"); // NumberFormatException
shortValue = Short.valueOf("+321"); // NumberFormatException
}
}