0

Exception java help

what is wrong with my code?why it cant detect the 2nd exception?it only shows the first one.how do i make it show two exceptions https://code.sololearn.com/c3lDhTZpfd4f/?ref=app

3rd Nov 2017, 8:28 PM
oyl
3 odpowiedzi
+ 5
The reason is when it encounters the first exception it woun't continue executing the rest of the code. So it never encounters the second exception. To see that you can define a variable say z out side of the try/catch statement and change it immediately after the first exception and also define a finally block and print z. You will see that z has not been changed after the first exception.
3rd Nov 2017, 8:37 PM
Vahid Shirbisheh
Vahid Shirbisheh - avatar
+ 1
i supposed after java see 1st error a [5] it is jump to catch, that's it
3rd Nov 2017, 8:35 PM
buran9
buran9 - avatar
0
how do i make it catch two exceptions?
3rd Nov 2017, 8:36 PM
oyl