ljwen

lj's blog

For循环

 1/**
 2 * 此类考的是for循环
 3 * 执行结果:ABDCBDCB
 4 * @author Administrator
 5 */

 6public class TFor {
 7    
 8        static boolean foo(char c) {
 9           System.out.print(c);
10           return true;
11        }

12        public static void main(String[] argv) {
13           int i = 0;
14           //for循环的格式是(表达式; 布尔表达式 ; 表达式) 
15            //for循环第一次执行的顺序是 A->B->D->C 
16           //接下来每次循环都是 B->D->C
17           //最后当B为false时,推出循环。
18           for (foo('A'); foo('B'&& (i < 2); foo('C')) {
19               i++;
20               foo('D');
21           }

22           
23//           for("jjyy".charAt(1) ;true ;"sdf".charAt(2)){
24//               System.out.println("11") ;
25//           }
26        }

27    
28}

posted on 2009-05-19 08:42 陆军 阅读(61) 评论(0)  编辑  收藏


只有注册用户登录后才能发表评论。


网站导航:
 

My Links

Blog Stats

常用链接

留言簿(2)

随笔档案

搜索

最新评论

阅读排行榜

评论排行榜