+ 2

Why does this not work (Java Exepctions)

What do I need to do to trigger the Exepction block? https://code.sololearn.com/c4glCZspZ4to/?ref=app

3rd Nov 2020, 11:36 PM
Cam UOR
Cam UOR - avatar
4 Risposte
+ 8
It doesn‘t work because you are trying to assign an undeclared variable to x which results in a compile-time error. Exceptions can be caught during runtime only.
4th Nov 2020, 12:51 AM
_cm_
+ 5
Cam UOR You’re welcome. Glad I could help. ;)
4th Nov 2020, 7:31 AM
_cm_
+ 2
x=1/0; for example
4th Nov 2020, 12:10 AM
Benjamin Jürgens
Benjamin Jürgens - avatar
+ 1
_cm_ Ah thank you for explaining the difference now I understand.
4th Nov 2020, 1:42 AM
Cam UOR
Cam UOR - avatar