我正在尝试运行此循环,但我一直收到错误:
预期的标识符
'.class'expected
都在第4行
public static void main(String[] args) {
int[] x = {98, 30, 97, 10, 5};
int[] y = new int[5];
for (int i = 0, int j = 4 ; i <= 4 && j >= 0; i++,j-- )
{
System.out.print(x[i]);
}
}
答案 0 :(得分:9)
类型声明只允许在for
循环initialization expression
for (int i = 0, j = 4; i <= 4 && j >= 0; i++, j--)