读书人

TryCatchFinally.java 的return 有关问

发布时间: 2012-10-07 17:28:51 作者: rapoo

TryCatchFinally.java 的return 问题。

static int f() {// 这里报编译错误:must return a resutl of type int!int id = 0;try {return id;} catch (Exception e) {} finally {}}static int f2() {// 但是这里怎么不报 错误呢?int id = 0;try {return id;} finally {}}

参考资料:1.http://topic.csdn.net/u/20091211/15/a8228a73-f2fe-40c0-92f2-1482224f41dd.html
2.http://download.oracle.com/javase/1.4.2/docs/tooldocs/windows/javap.html

读书人网 >编程

热点推荐