Java review Summary: Java Object-Oriented Programming-exception capture and handling, packet and access control permissions
1. Exceptions are a type of command flow that causes program interruption. When exceptions occur, if they are not properly processed, the program will be interrupted.
2. for exceptions, try... Try... Catch... Finally, catch exceptions in the try statement, and handle exceptions in the catch statement. Finally serves as the unified exit for exceptions. This code segment must be executed no matter whether an exception occurs or not.
3. The maximum parent class of an exception is throwable, which is divided into two subclasses: exception and error. Exception indicates an exception processed by the program, and error indicates a JVM error, which is not handled by the program developer.
4. when an exception occurs, the JVM automatically promotes the instantiation object of an exception class and matches the exception type in the catch statement. You can also use the upward transformation relationship of the object to directly catch all exceptions through exception.
5. Throws is used in the method declaration, indicating that this method does not handle exceptions.
6. Throw indicates that an exception is thrown manually in the method.
7. When creating a custom exception class, you only need to inherit the exception class.
8. assertion is a new function provided after jdk1.4. it can be used to detect program execution results. However, assertion is not recommended in development.
9. Using packages in Java can implement the card sending mode for writing by multiple people. Avoid repeated class names.
10. Use the package keyword in Java to put a class into a package.
11. You can use the Import Statement in Java to import an existing package.
12. If a program imports a class of the same name without a package, you must explicitly write "package. Class Name" during use ".
13. There are four types of access control permissions in Java: private, default, protected, and public.
14. Use the jar command to compress a package into a jar file for your use.