-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram10.java
More file actions
42 lines (41 loc) · 735 Bytes
/
Program10.java
File metadata and controls
42 lines (41 loc) · 735 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
import java.io.*;
import java.util.*;
class M
{
void method()throws IOException
{
throw new IOException("device error");
}
}
class Program10
{
public static void main(String[] args)
{
Scanner in=new Scanner(System.in);System.out.println("Enter two number");
int a=in.nextInt();
int b=in.nextInt();
try
{
int d=a/b;
System.out.println("Division is="+d);
}
catch(ArithmeticException e)
{
System.out.println("int number can noy be divide by zero");
System.out.println(e);
}
finally
{
System.out.println("finally block is executed");
}
try{
M m=new M();
m.method();
}
catch(Exception e)
{
System.out.println("exception handled");
}
System.out.println("normal flow...");
}
}