In main, I have to call some methods in this order:
try {
instance.method1()
} catch (SecurityException | IOException e) {
e.printStackTrace();
}
// Other methods...
try {
instance.method2
} catch (XMLStreamException | IOException e) {
e.printStackTrace();
}
// Other methods...
try {
instance.method3
} catch (XMLStreamException | IOException e) {
e.printStackTrace();
}
The question is: Is better to handle the methods in different try-catch statments, or all methods in one handler, as below?
try {
instance.method1
instance.method2
instance.method3
} catch (XMLStreamException | IOException | SecurityException e) {
e.printStackTrace();
}