My code for reading an input stream of numbers and sorts them into an array, returns error:
unreported exception IOException; must be caught or declared to be thrown
on String lines = br.readLine();
public int[] inputArr() {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String lines = br.readLine();
String[] strs = lines.trim().split("\\s+");
int [] a = new int [strs.length];
for (int i = 0; i < strs.length; i++) {
a[i] = Integer.parseInt(strs[i]);
}
return a ;
}
Any help please on this?