【趣味题】亲~你能猜出它的结果么?

猜猜看,不编译运行情况下,当输入1,你能猜出它的结果么?亲~

 1 import java.util.*;
 2 public class A {
 3 public static void main(String[] args) throws Exception {   
 4     int[] x = new int[6];   
 5     Arrays.fill(x, 1);   
 6     for (int i = 0; i < x.length; i++) {   
 7         System.in.read();   
 8         System.out.println(x[i]);   
 9     }   
10   }  
11 }

 

午间在Iteye论坛乱逛了下,又发现一有点意思的题,再贴上来~其实说实话,这一直这么递归循环下去,迟早栈溢出,当栈溢出之后,接下来便是难于意料的各种结果

,为了印证下结果,编译运行了一下,基本结果差不多,但还是有个不明白,不理解为什么这catch没捕获到?总之,这些题就是很蛋疼,唉。。。偶尔当做调味料趣味下就行

 1 private static void foo() {      
 2         try {      
 3             System.out.println("try");      
 4             foo();      
 5         } catch (Throwable e) {      
 6             System.out.println("catch");      
 7             foo();      
 8         } finally {      
 9             System.out.println("finally");      
10             foo();      
11         }      
12     }      
13          
14     public static void main(String[] args) {      
15         foo();      
16     } 

 

posted @ 2011-07-19 00:29  Sunshine.Wu  阅读(343)  评论(1)    收藏  举报