Hi,
I was wondering why the File class constructor doesn't need a checked exception in case the file path would be wrong or the file doesn't exist.
For example if we use a Scanner to read from a file, the Scanner constructor does throws FileNotFoundException.
Why do Java only checks it there and not when the File object is created? What is behind this?
File inFile = new File("c:/myfile.txt");
Scanner sc = new Scanner(inFile); // can throw FileNotFoundException
Thanks in advance for any comments.