Given below the sample code :
static void check() throws RuntimeException {
try {
System.out.print("checking ");
throw new RuntimeException();
}
catch (Exception ex) { System.out.print("runtime"); }
}
public static void main(String[] args) {
try { check(); }
catch (RuntimeException ex) { System.out.print("exception"); }
System.out.print("success");
}
What will be the output of the above code ?
1. Compile error
2. checking runtime success
3. checking runtime exception success
4. checking success
(2)
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.