Try catch block | Sololearn: Learn to code for FREE!

0

Try catch block

Why doesn't the try catch block catch this exception?.... shouldn't it catch all exceptions? https://code.sololearn.com/cZfqMiLLcx1H/?ref=app

10/21/2020 11:10:43 AM

Sheldon 10110

4 Answers

New Answer

+4

Because the compiler catch it first. catch will catch exceptions at runtime.

0

Why is this?

0

Just search for the difference between compile errors and runtime errors and you will find an answer.

0

Aaaaah I hadn't seen the runtime part...thanks... I get it now