File tree 2 files changed +20
-1
lines changed
2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -126,7 +126,7 @@ The Java Domain is further Divided into the following sub-domains.
126
126
| Problem | Solution Link | Difficulty |
127
127
| ---------| ---------------| ------------|
128
128
| [ Java Exception Handling] ( https://www.hackerrank.com/challenges/java-exception-handling ) | [ Solution] ( https://github.com/anishLearnsToCode/hackerrank-java/blob/master/src/JavaExceptionHandling.java ) | Easy |
129
- | [ Java Exception Handling (try-catch)] ( https://www.hackerrank.com/challenges/java-exception-handling ) | | Easy |
129
+ | [ Java Exception Handling (try-catch)] ( https://www.hackerrank.com/challenges/java-exception-handling-try-catch/problem ) | | Easy |
130
130
131
131
132
132
### Java Advanced
Original file line number Diff line number Diff line change
1
+ // https://www.hackerrank.com/challenges/java-exception-handling-try-catch/problem
2
+
3
+ import java .util .InputMismatchException ;
4
+ import java .util .Scanner ;
5
+
6
+ public class JavaExceptionHandlingTryCatch {
7
+ public static void main (String [] args ) {
8
+ Scanner scanner = new Scanner (System .in );
9
+ try {
10
+ int x = scanner .nextInt ();
11
+ int y = scanner .nextInt ();
12
+ System .out .println (x / y );
13
+ } catch (InputMismatchException exception ) {
14
+ System .out .println (exception .getClass ().getName ());
15
+ } catch (Exception exception ) {
16
+ System .out .println (exception );
17
+ }
18
+ }
19
+ }
You can’t perform that action at this time.
0 commit comments