Will the code after throw be executed?

As shown in the figure code, will the code be executed when throws is thrown out here?

Then there’s why catch is not captured here, and the next is catch capture and throw again.

I ask you all.

The problem has been solved. Thank you for your answer.

Answer 0:

It will not run.

1：Runtime exceptions are exceptions to the RuntimeException class and its subclasses, and are non-checked exceptions such as NullPointerException, IndexOutOfBoundsException, and so on. Because this exception is a system exception.Unable to handle, such as network problems;Either a program logic error, such as a null pointer exception; the JVM must stop running to correct the error, so the runtime exception can be handled by the JVM itself without being caught or thrown up. Java Runtime will automatically catch to program t.Hrow RuntimeException, then stop the thread, print exceptions.2：Non-runtime exceptions are exceptions other than RuntimeException, which belong to the Exception class and its subclasses and are detected exceptions. Non-runtime exceptions must be handled (captured or thrown up), and if not handled, the program will experience compilation errors. Normally,API writes that throws’s Exception is not RuntimeException.

Answer 1:

After the first place throws an exception, the following code will not continue to execute.

Why?try catchThe following is not necessary because the following block of code may have multiple anomalies.

Answer 2:

The code after the exception is thrown will not execute unless it is the final block in try… catch… finally.

JavaThere are two main categories of Exceptions: Checked, which throws must be captured with try.. catch, and Runtime Exception does not force try.. catch.

Answer 3:

If your screenshot SeckillException is not captured by the upper layer, the following will not be executed.But if you look at the screenshots of IDE, the Yellow code will be issued if the following code can not be executed.

So, bother to paste the code of the whole method.

Answer 4:

If the code you box executes and throws an exception, it will be dropped by the catch below, and if the code after that will not execute; if no exception is thrown, the code will continue to execute until a new exception or method is executed.