0
How can i call two different methods in a single try catch
java program
2 odpowiedzi
+ 1
MyObject myObj = new MyObject();
try {
myObj.myFunction1();
myObj.myFunction2();
} catch(Exception e) {
// do something
}
// if you meant handle two errors
// in different ways you can use
// multiple catch
try {
myObj.myFunction1();
myObj.myFunction2();
} catch(IOException e1) {
// do something
} catch(NullPointerException e2) {
// do other things
}
0
thanks