Java - comma operator outside for loop declaration

前端 未结 2 760
南旧
南旧 2021-01-02 14:37

I know I can use the comma operator like this

for (int i = 1, j = 15; j>10; i++, j--) {
    // do something neat
}

but some articles see

2条回答
  •  粉色の甜心
    2021-01-02 14:49

    https://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.27

    15.27. Expression

    <...>

    Unlike C and C++, the Java programming language has no comma operator.

提交回复
热议问题