This is something that\'s been bugging me for a while with regards to Program Flow.
I wanted to know if it\'s possible to catch an error from a Method in order to stop i
You put method01
and method02
in to same try
block:
public class MyClass {
public static void main(String[] args) {
try {
// This method catches an exception and stops running.
method01();
// This method will not continue if method01 have exception.
method02();
} catch (Exception e) {
e.printStackTrace();
}
}
// declare method01, method02, others...
}
Notice: You have mistakes at the end of code block ( }; }; )