|
||
|
Checked Exceptions in a try-catch block
Example
The java.io.IOException is a checked exception, so you'll need to wrap all calls to this method in a
try-catch block.
|
||
try { int[] b = new int[10]; for ( int i = 0; i < b.length; i++) { int datum = System.in.read(); if (datum == -1) break; b[i] = datum; } } catch (IOException e) { System.err.println("Couldn't read from System.in!"); } |
||
|
|
||