开发者

Am I correct supposing that if an exception occurs inside a try block, following lines inside the try are never executed?

开发者 https://www.devze.com 2023-01-24 03:03 出处:网络
In the followi开发者_JS百科ng example try { lineA lineB lineC lineD } catch { lineE } finally { lineF } if an exception occurs (let\'s assume a 100% probability of an exception there) in lineB, the

In the followi开发者_JS百科ng example

try {
  lineA
  lineB
  lineC
  lineD
}
catch {
  lineE
}
finally {
  lineF
}

if an exception occurs (let's assume a 100% probability of an exception there) in lineB, then the total execution algorithm looks like

lineA  
lineB  
lineE  
lineF  

lines C and D are never reached. Am I 100% right?


Yes, you're correct presuming exception thrown is of type caught in catch block

0

精彩评论

暂无评论...
验证码 换一张
取 消