import java.io.FileReader; import java.io.IOException; /** * Reasonable exception handling, which is about all you can do in * this short a program. Again, doo can throw an IOException * Main uses a try-catch to handle the exception possibility. * If an exception occurs, print an error message and exit. * * Created: Jan 2022 * @author gtowell */ public class ExGood { /** * A function that opens a FileReader -- for no real reason * @param filename the name of the file to try to open * @throws IOException */ public void doo(String filename) throws IOException { FileReader bb = new FileReader(filename); } public static void main(String[] args) throws IOException { ExGood ex = new ExGood(); try { ex.doo("20"); } catch (IOException ioe) { System.err.println("Problem calling doo with arg 20" + ioe); return; } } }