|
1. Exception category:
Error and exception.
Exception is divided into runtime exception and checked exception.
The above differences correspond to the situations
2. Try catch and try catch finally related syntaxes and notes for Exception Handling
Only one catch is processed, and finally is always processed, even if return, unless system. Exit ();
3. Use and difference of throws and throw (self-designed exceptions)
Why throws? Let the caller handle the exception!
Throws declares that a method has a checked exception, and throw throws an exception in the method. Generally, the two are used together to throw a checked exception in the method and indicate an exception in the method declaration. However, you can also throw a runtime exception in the method, so throws are not required in the method, because the runtime exception does not need to be specially processed.
4. Exception and method Rewriting
If a method in the parent class throws an exception, when the subclass inherits the parent class and modifies the method in the parent class, you must pay attention to this problem, the exception classes thrown by the methods rewritten in the subclass must be automatically converted to the exception classes in the parent class. (Included by the exception class in the parent class)
Reference: Java se6 comprehensive learning Java getting started and improving
Code omitted
I have actually done a lot of things this week. I have read the code of the recruitment office, read several XML papers, and read object-oriented in Java's comprehensive learning, I also read the above exceptions, container and layout configuration, event processing, and AWT component usage. I just didn't write it out, but I was tired of typing on the keyboard,
Make up for the weekend.
|