try catch finally执行顺序
无return时:try -> catch ->finally
有return时:返回值在catch语句时,先执行完finally语句再执行catch语句,要有变量在finally改变,catch中有临时变量存储未修改的返回值,执行完finally语句后返回临时变量存储得值。
返回值在finally语句中,直接执行到finally语句就返回,catch的return作废。
无return时:try -> catch ->finally
有return时:返回值在catch语句时,先执行完finally语句再执行catch语句,要有变量在finally改变,catch中有临时变量存储未修改的返回值,执行完finally语句后返回临时变量存储得值。
返回值在finally语句中,直接执行到finally语句就返回,catch的return作废。