Je travaille avec ces méthodes de générateur de classe:Java, essayez-enfin sans prise
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");
}
Je les ai utilisé avec ce code:
public void execute() throws MyException
Generator generator = new Generator();
try {
String string = "exception";
generator.executeAction(string);
} finally {
generator.close();
}
}
Dans principal j'ai manipulé l'exception:
try {
manager.execute();
} catch (MyException e) {
System.err.println(e.toString());
}
}
En main je peux l'attraper. Est-ce un comportement normal?
Pourquoi cette exception devrait-elle être supprimée? – user2357112
Désolé, je corrige la question – Stefano
entre finalement en jeu exception ou non. Donc, si une exception est levée et non interceptée, cela n'affecte finalement pas – efekctive