Mega Code Archive
Categories
/
Java Tutorial
/
Data Type
To catch illegal number conversion, try using the trycatch mechanism
public class Main { public static void main(String[] args) throws Exception { try { int i = Integer.parseInt("asdf"); } catch (NumberFormatException e) { ; } } }