Can finally be used without catch?
I'll answer
Earn 20 gold coins for an accepted answer.20
Earn 20 gold coins for an accepted answer.
40more
40more
Studied at Harvard University, Lives in Cambridge, MA
The try block defines which lines of code will be followed by the finally code. If an exception is thrown prior to the try block, the finally code will not execute. The finally block always executes when the try block exits. So you can use finally without catch but you must use try.
2023-05-10 14:10:00
评论(499)
Helpful(122)
Helpful
Helpful(2)

Charlotte Nelson
QuesHub.com delivers expert answers and knowledge to you.
The try block defines which lines of code will be followed by the finally code. If an exception is thrown prior to the try block, the finally code will not execute. The finally block always executes when the try block exits. So you can use finally without catch but you must use try.