本地运行结果
1406998982171 this is finally time
1406998982165 this is return time
return 的时间是要早一些的
- public class TryTest
- {
- public static void main(String[] args) {
-
- System.err.println(test()+" this is return time");
- }
-
- private static long test(){
- try{
- return System.currentTimeMillis();
- }catch(Exception e){
-
- }finally{
- for(int i = 0; i < 1000000000; i++){
- }
- System.err.println(System.currentTimeMillis()+" this is finally time");
- }
- return 0;
- }
- }
复制代码 |