0
Compile time error check java
How can I catch a compile time error in java so my code can work? https://code.sololearn.com/czEaBv66FYe6/?ref=app
3 Answers
+ 1
You cannot catch a compile time error. But you can catch a runtime exception.
H h generates an error. To throw an exception and be able to catch it, change your code as the following(see the modified try block):
https://code.sololearn.com/c7y5mk5rV4UR/?ref=app
This code works fine
+ 1
Deepesh Choudhary I know that thing already but it loses my purpose... Are you sure there is no way I can catch compile time error?
+ 1
Saksham Jain No, compiler errors cannot be caught programmatically