Java – how to handle exceptions if a try block is followed at the end
•
Java
If I ended up using only the catch block, how would I handle exceptions
Solution
The exception will be passed up the call stack as if your try block does not exist, except that the code in finally will be executed
Some sample code
try { // an exception may be thrown somewhere in here } finally { // I will be executed,regardless of an exception thrown or not }
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码