import java.util.Scanner; /** Error2.java - What could go wrong if we convert a string to int? */ public class Error2 { public static void main(String [] args) { String [] a = { "8", "-2", "five", "0" }; // Let's traverse the array of strings, and convert each string // to an integer. The following loop is incorrect because it // will not catch the run-time error. for (int i = 0; i < a.length; ++i) { int n = Integer.parseInt(a[i]); System.out.println(n); } } }