samedi 25 avril 2015

Why can there be an ArrayOutOfBounds Exception when you are opening a file in java using FileInputStream?


Why is there a need to check ArrayIndexOutOfBounds in FileInputStream in java? This same code is given as an example in a book for core java.

FileInputStream fis;
try{
    fis=new FileInputStream("inputFIle.txt");       
}catch(FileNotFoundException e){
    System.out.println("File was not found");
}catch(ArrayIndexOutOfBoundsException e){
    e.printStackTrace();
}


Aucun commentaire:

Enregistrer un commentaire