for循环的多个条件

MrD*_*MrD 1 java

我正在写一个for循环如下:

for(int i = row, int j = col; i < rows, j < cols; i++, j++)
Run Code Online (Sandbox Code Playgroud)

然而,似乎Java并不喜欢它......有什么方法可以实现类似的东西吗?

谢谢!

Mik*_*ike 5

使用 &&.此外,int只有一次.

for(int i = row, j = col; i < rows && j < cols; i++, j++)