The need to catch IOExceptions & Exceptions
问题 Should one always catch an IOException/Exception if a program reading in a txt file using a scanner object produces nothing but a FileNotFoundException? Would such extra code be unneeded or important? import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; public class TestingScanner { public TestingScanner() { readFile("dummy.txt"); } public void readFile(String filePath) { File file = new File(filePath); Scanner scanner = null; try { scanner = new Scanner(file);