Tag: 逗号运算符

Java – 用于循环声明的逗号运算符

我知道我可以像这样使用逗号运算符 for (int i = 1, j = 15; j>10; i++, j–) { // do something neat } 但是有些文章似乎暗示逗号运算符可以在for循环声明之外使用,例如 int j = 2, k = 4 ; int x ; // Assignment statement with comma operator x = j + 1, k ; 来源: http : //www.cs.umd.edu/~clin/MoreJava/ControlFlow/comma.html 要么 int x = (expression) ? (i++,2) : […]