-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathException.java
More file actions
34 lines (30 loc) · 863 Bytes
/
Exception.java
File metadata and controls
34 lines (30 loc) · 863 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
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class Solution {
public static void main(String[] args) {
/* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
Scanner obj = new Scanner(System.in);
int a = 0, b = 0, c;
try
{
a = obj.nextInt();
b = obj.nextInt();
try
{
c = a/b;
System.out.println(c);
}
catch(ArithmeticException e)
{
System.out.println("java.lang.ArithmeticException: / by zero");
}
}
catch(Exception e)
{
System.out.println("java.util.InputMismatchException");
}
}
}