[ldale@bianca fileIO]$ javac FileIOClient.java
FileIOClient.java:24: unreported exception java.io.FileNotFoundException; must be caught or declared to be thrown
Scanner sc = new Scanner(new File(fileName));
^
1 error
Our original error message reminds us of our choices with checked exceptions.
[ldale@bianca fileIO]$ diff FileIOClient.java FileIOClient_2a.java
4c4
< public class FileIOClient{
---
> public class FileIOClient_2a{
6c6
< public static void main(String [] args){
---
> public static void main(String [] args) throws FileNotFoundException {
[ldale@bianca fileIO]$ diff FileIOClient.java FileIOClient_2b.java
4c4
< public class FileIOClient{
---
> public class FileIOClient_2b{
22a23,24
> try {
>
38a41,46
> } catch (FileNotFoundException e) {
> System.out.printf("\n\n\tERROR: Your file %s is not found."
> + " Please locate and try again.\n\n"
> , fileName );
> }
>