Exception handling for Java compilation

after compiling exception capture, what do you usually do, just simply print the exception information?

Feb.26,2021

compilation is wrong. There must be something wrong with the code. In addition to changing the problematic code to make the program compile, what else do you want to do?


according to the summary of the second edition of "Effect Java":
exceptions are divided into:

  1. checked exception (checked exception,. By compiler exception, you mean this, right?
  2. Runtime exception (runtime exception)
  3. error (error)

Runtime exceptions and errors are thrown structures that are not needed and should not be caught. If the program throws a runtime exception or error, it means that there is an unrecoverable situation, and it will do more harm than good to continue execution. If such a structure is not captured, it will cause the current thread to stop and an appropriate error message will appear.

principles of use:

  1. if the caller is expected to recover appropriately, the checked exception is used for this case.
  2. indicates programming errors with run-time exceptions.
  3. if it is not clear whether recovery is possible, an unchecked exception is used.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e97638-4eb20.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e97638-4eb20.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?