1.finally
Public Static int func () { try{ return 1; } Catch (Exception e) { return 2; } finally { return 3; } }
Public Static int func () { try{ thrownew Exception (); } Catch (Exception e) { return 2; } finally { return 3; } }
The return value is 3, which indicates that the code of the finally block is executed before the normal return;
Relationships between 2.java exception-handling classes
Exception inheritance structure: The base class inherits Throwable,runtimeexception and IOException inheritance from Throwable,error and Exception Exception
Non-runtimeexception is generally an external error, which must be captured by the Try{}catch statement block
The error class system describes internal errors and resource exhaustion scenarios in the Java operating system, and error does not require capturing
3. Thread run () method
Thread classes want to open a new thread the start () method must be executed, and the run () method implemented by the class is called inside the start () method. If you execute run (), it is equivalent to executing a normal method that belongs to the current thread.
Java Basics Supplements (ii)