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

4th Apr 2019, 2:21 PM
Saksham Jain
Saksham Jain - avatar
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
4th Apr 2019, 2:56 PM
Deepesh Choudhary
Deepesh Choudhary - avatar
+ 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?
4th Apr 2019, 3:06 PM
Saksham Jain
Saksham Jain - avatar
+ 1
Saksham Jain No, compiler errors cannot be caught programmatically
4th Apr 2019, 3:08 PM
Deepesh Choudhary
Deepesh Choudhary - avatar