- If a annotation defines a property and the name is value, then there are two ways to assign a value to it when using this annotation, one is ("value") one is (value=value value), if the property name is not value, Then you can only use the second method!
- JUnit Framework 3.0, the class to be tested needs to inherit the TestCase class, and the method that needs to be tested needs to start with the name of test! 4.0, directly using @test written on the method above, you can test!
- Exceptions in Java can be divided into two classes of checked exception (non-runtime exception), the second unchecked exception (runtime exception), As long as the exception that inherits RuntimeException is a run-time exception, the class that inherits exception does not inherit Runtimeexceptio is called a non-runtime exception! Note that RuntimeException also inherits Exception, but Exception is a non-runtime exception
- If a method throws a non-runtime exception, such as throw Exception (), for a non-runtime exception that must be handled at the time of writing the program, there are two ways to handle it, and one is to catch the exception at a try catch at the method call. The second is to throw out the method declaration of this method, for example, with throws Exception, if the compiler does not handle the error
- For run-time exceptions, such as a divisor of zero, this exception does not need to be handled, and the recommended practice is not handled!
- The execution process for a try Catch finally is: An exception is produced in a sentence in a 1,try statement block, after which the statement in the statement block is not executed, and if the resulting exception matches the exception in the catch parenthesis, then the statement in the block of the catch statement is executed! 2, if no exception is generated, the statement in the TRY statement block is executed and the statement in the CATCH statement block is not executed.
- Regardless of whether an exception occurs, the statements in the finally statement block are executed. A statement that contains a large statement block of Try catch, even if the statement behind those try catch blocks executes
- Null pointer exception occurs because a reference to a null, and you also use this reference to call a method, you will definitely report NULL pointer exception!
San Think garden Java SE Training Summary (69-) (Annotation, exception handling)