JAVA
java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/*
Created by LukArToDo
Date: 5.may 2019
Description: Handling with exceptions 😁
Note: Inspired by discussion with Voja 😉
*/
public class CatchExceptions{
public static void main(String[] args) throws MyExceptions {
int arr[]=new int[2];
String str=null;
try{
// int a=Integer.parseInt(str);
// arr[4]=5;
// int b=5/0;
// System.out.println(str.length());
System.out.println("To see how exceptions handling works, uncomment some of the four lines above (in the try block). Note: only one line need to be uncommented. Enjoy playing whit this code :)");
}catch(Exception e){
throw new MyExceptions(e);
}
}
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run