
Originally Posted by
keang
If you'd read the link I gave you you would have seen you can put multiple statements in a single try block. So you just need to put all five methods calls within the one try block.
Maybe my situation is a little different:
Code:
//Main
MyObject ob = new MyObject();
class MyObject {
public MyObject() {
method1();
}
public void Method1() throws IOException, XMLStreamException{
int event = xmlreader.next();
if (event == ...........................) {
method2();
..................
}
}
public void Method2() throws IOException, XMLStreamException{
int event = xmlreader.next();
if (event == ..................... ) {
method3();
..................
}
}
}
}
SO I repeat my question: must I put try/catch inside each MethodX either I can put one in main class?