我收到此错误“作业的左侧必须是变量”
public class employee {
public static void main (String args[ ]){
for(int i = 0; i < 10; i++)
int sum = 10; // getting error over here
}
}
但是,如果我按如下所示更改代码,则错误消失
public class employee {
public static void main (String args[ ]){
for(int i = 0; i < 10; i++) { //add braces over here
int sum = 10;
}
}
}