forked from CMPundhir/JavaExamples
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExceptionHandling.java
More file actions
Latest commit
22 lines (21 loc) · 500 Bytes
/
Copy pathExceptionHandling.java
File metadata and controls
22 lines (21 loc) · 500 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
importjava.util.*;
classExceptionHandling{
publicstaticvoidmain(String[] args){
Scannersc = newScanner(System.in);
inta=0,b,c;
try{
System.out.println("Enter a = ");
a = sc.nextInt();
System.out.println("Enter b = ");
b = sc.nextInt();
c = a / b;
System.out.println(c);
}catch(ArithmeticExceptione){
System.out.println(e);
}
finally{
System.out.println("I am finally and i always run...");
}
System.out.println("program is still working...");
}
}