-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexception_program1.java
More file actions
65 lines (58 loc) · 892 Bytes
/
Copy pathexception_program1.java
File metadata and controls
65 lines (58 loc) · 892 Bytes
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/*
error :abnormal condition of execution of your program.
ArithmeticException
Arrayindexoutofboundexception
Stringindexoutofboundexception
illegalargumentexception
negativearraysizeexception
numberformatexception
*/
import java.util.*;
class exception_program1
{
public static void main(String[] args)
{
try
{
int a=100/0;
System.out.println(a);
// infinite.
}
catch(ArithmeticException e)
{
System.out.println(e);
}
finally
{
System.out.println("aadarsh");
}
try
{
int arr[]=new int[5];
arr[10]=245;
}
catch(ArrayIndexOutOfBoundsException ae)
{
System.out.println(ae);
}
try
{
String s="yogesh";
int r=Integer.parseInt(s);
}
catch(NumberFormatException aee)
{
System.out.println(aee);
}
try
{
String s=null;
int rr=s.length();
System.out.println(rr);
}
catch(NumberFormatException aee)
{
System.out.println(aee);
}
}
}