finally必須和try一起使用 try catch finally哪個(gè)可有可無?
try catch finally哪個(gè)可有可無?配對(duì)方法1:try{}catch{}配對(duì)方法2:try{}catch{}finally{}配對(duì)方法3:try{}finally{}因此可以看出,catc
try catch finally哪個(gè)可有可無?
配對(duì)方法1:try{}catch{}配對(duì)方法2:try{}catch{}finally{}配對(duì)方法3:try{}finally{}因此可以看出,catch和finally都不是必需的,try和catch也不是必須配對(duì)的,但是如果有try,則必須選擇一對(duì),catch或finally,或者兩者都是