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循环后面加一个分号,输出结果完全不一样。

版权声明:本文为博主原创文章,未经博主允许不得转载。

原文地址:https://www.cnblogs.com/penggy/p/4786483.html