I am having problems with the try/catch of IOException and Exception
public void generateReport()
{
try {
PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("outputFile.text")));
} catch (IOException ioe) {
System.out.println("Can't load the file: " + ioe);
ioe.printStackTrace();
throw ioe;
} catch (Exception e) {
System.out.println("Problem: " + e);
e.printStackTrace();
throw e;
}
}
compiler says it is an unreported exception and must be caught or declared to be thrown. I don't understand what this means. Please help
public void generateReport()
{
try {
PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("outputFile.text")));
} catch (IOException ioe) {
System.out.println("Can't load the file: " + ioe);
ioe.printStackTrace();
throw ioe;
} catch (Exception e) {
System.out.println("Problem: " + e);
e.printStackTrace();
throw e;
}
}
compiler says it is an unreported exception and must be caught or declared to be thrown. I don't understand what this means. Please help