“This is the 11th day of my participation in the Gwen Challenge in November. See details: The Last Gwen Challenge in 2021.”

The vast sea of millions, thank you for this second you see here. I hope my article is helpful to you!

May you keep your love and go to the mountains and seas in the coming days!

Note: yesterday we learned about the abnormal system part of what? But it’s a pretty big system, so let’s take a look.

😄 Abnormal large system

  • Exception architecture:

📭 Detected and undetected anomalies

Generally, Java exceptions (Throwable) are classified as checked exceptions and unchecked exceptions (unchecked exceptions).

💡 Abnormal

Exceptions that the compiler requires that must be handled.

  • Correct program in the running process, often easy to appear, in line with the expected abnormal situation. Once such exceptions occur, they must be handled in some way. With the Exception of RuntimeException and its subclasses, the Exception class and its subclasses are checked for non-runtime exceptions.
  • This exception is checked by the compiler, which means that when the compiler detects a possible exception somewhere in the application, it will prompt you to handle the exception — either using a try-catch or throwing with the throws keyword using the method signature, or the compiler fails.

💡 Not abnormal

The compiler does not check and does not require exceptions that must be handled.

  • This type of exception is when an exception occurs in our program, even if we don’t have onetry-catchIt is captured and not usedthrowsThrow this exception, and the compilation will pass. This class includes runtime exceptions (RuntimeException and subclasses) and errors. When a RuntimeException occurs, it indicates that a programming error has occurred in the program, so you should find the bug modifier instead of catching a RuntimeException.

😮 Exception handling mechanism (key)

In Java applications, the exception handling mechanism is: throw an exception, catch an exception.

🐁 Java exception handling

  • In Java, once a method throws an Exception, the system automatically looks for an Exception Handler to handle the Exception according to the Exception object. It classifies different exceptions and provides a good interface.

  • In Java, each exception is an object that is an instance of the Throwable class or a subclass of it. When an exception occurs in a method, an exception object is thrown. This object contains the exception information, and the method calling this object can catch the exception and handle it.

  • Java exception handling involves five keywords: try, catch, finally, throw, and throws.

  • In Java applications, exception processing is divided into declare exception throws, and catch exception try, catch, and finally.

    Let me tell you more about it in the next few days.

🌸 summary

I believe that you have a general understanding of the concept of the exception system and exception handling mechanism, so we continue to look forward to the next chapter of the exception more content! Welcome to the next chapter!

Let’s refuel together, too! I am not just, if there is any missing, wrong place, also welcome you to criticize in the comments of talent leaders! Of course, if this article is sure to help you a little, please kindly and lovely talent leaders to give a thumb-up, favorites, one key three even, thank you very much!

Here, the world is closed for today, good night! Although this article is over, I am still here, never finished. I will try to keep writing articles. The coming days are long, why fear the car yao ma slow!

Thank you all for seeing this! May you live up to your youth and have no regrets!

\