在try-catch-finally语句中使用return语句遇到了一些疑问
代码一:
static int intc(){ int x =0; try{ x=1; return x; }finally { x = 3; } }
代码二:在上面那段代码的finally语句中加入了return语句
static int intc(){ int x =0; try{ x=1; return x; }finally { x = 3; return x; } }
代码三:
static int intc(){ int x =0; try{ x=1; return x; }finally { x = 3; return 0; } }
那么这三个方法的执行结果是多少呢?
代码一:返回1;
代码二:返回3;
代码三:返回0;