java--for循环,一个分号的区别


public class Test {
 public static void main(String[] args) {
  int x=1;
  int y=1;
  for(System.out.println("a");x<3;System.out.println("b"),x++);{
   System.out.println("c");
  }
  System.out.println("*******************************");
  for(System.out.println("a");y<3;System.out.println("b"),y++){
   System.out.println("c");
  }
 }
}
输出结果如下:
a
b
b
c
*******************************
a
c
b
c
b

在第一个for循环后面加一个分号,输出结果完全不一样。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章