Datasets:
ArXiv:
License:
Stack-Repo
/
data
/train
/akash-coded
/FSD_Java
/Lesson-3
/Exception Handling
/Examples
/NestedTryBlock.java
| public class NestedTryBlock { | |
| public static void main(String args[]) { | |
| try { | |
| try { | |
| System.out.println("going to divide"); | |
| int b = 39 / 0; | |
| } catch (ArithmeticException e) { | |
| System.out.println(e); | |
| } | |
| try { | |
| int a[] = new int[5]; | |
| a[5] = 4; | |
| } catch (ArrayIndexOutOfBoundsException e) { | |
| System.out.println(e); | |
| } | |
| // System.out.println(25 / 0); | |
| System.out.println("other statement"); | |
| } catch (Exception e) { | |
| System.out.println("handeled"); | |
| } | |
| System.out.println("normal flow.."); | |
| } | |
| } | |