-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExceptions.java
More file actions
30 lines (23 loc) · 787 Bytes
/
Exceptions.java
File metadata and controls
30 lines (23 loc) · 787 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
import java.util.Scanner;
public class Exceptions {
public static void main(String[] args){
Scanner sc= new Scanner(System.in);
try{
System.out.println("Enter the 1st Value :- ");
int x= sc.nextInt();
System.out.println("Enter the 2nd Value :- ");
int y=sc.nextInt();
int z= x/y;
System.out.println(x + "/" + y + " = " + z);
}
catch(ArithmeticException ex){
System.out.println("----------------- CATCH Statement -------------------");
System.out.println("This Expression can not be executed.");
System.out.println(ex.toString());
}
finally{
System.out.println("Made By :- Amulya Gupta");
System.out.println("Made on Date :- 17/12/2024");
}
}
}