I'm working with this methods of class Generator:
public void executeAction(String s) throws MyException {
if (s.equals("exception"))
throw new MyException("Error, exception", this.getClass().getName());
}
public void close() {
System.out.println("Closed");
}
I've used them with this code:
public void execute() throws MyException
Generator generator = new Generator();
try {
String string = "exception";
generator.executeAction(string);
} finally {
generator.close();
}
}
In main I handled the exception:
try {
manager.execute();
} catch (MyException e) {
System.err.println(e.toString());
}
}
In main i can catch it. Is it a normal behavior?