MY mENU


Friday 10 February 2012

NumberFormatException in Java


When we are converting a String value into int type then we can get NumberFormatException, if the String contains a non-integer number.

Example :

String s = "abc" ;
int num = Integer.parseInt(s);

- In the above example the String s contains the non-integer number (i.e. "abc"), and we are trying it to convert into integer type, at that time JVM will throwNumberFormatException.

No comments:

Post a Comment