Catch illegal number int value conversion with try/catch in Java
Description
The following code shows how to catch illegal number int value conversion with try/catch.
Example
//from w ww . j a v a 2 s . c o m
public class Main {
public static void main(String[] args) throws Exception {
try {
int i = Integer.parseInt("asdf");
} catch (NumberFormatException e) {
;
}
}
}
Home »
Java Tutorial »
Java Data Type »
Java Tutorial »
Java Data Type »