java中的编译器错误:需要标识符
排队java中的编译器错误:需要标识符,java,compiler-errors,Java,Compiler Errors,排队 for(int x,=0; x<=numberOfLockers; x++); for(intx,=0;x欢迎来到社区 您基本上已经回答了您的问题。您的for循环中有一个很小的语法错误 用于(int x,=0;xRemove,fromint x,=0在那一行。你似乎忘记了语言标记。欢迎使用StackOverflow。我编辑了你的问题和问题文本的标记,试图使其更具可读性。记住,这些标记吸引了正确的听众,因此如果你使用不相关的标记,你会得到错误的答案迪恩斯和你想要的观众都看不到这个问题
for(int x,=0; x<=numberOfLockers; x++);
for(intx,=0;x欢迎来到社区
您基本上已经回答了您的问题。您的for循环中有一个很小的语法错误
用于(int x,=0;xRemove,
fromint x,=0
在那一行。你似乎忘记了语言标记。欢迎使用StackOverflow。我编辑了你的问题和问题文本的标记,试图使其更具可读性。记住,这些标记吸引了正确的听众,因此如果你使用不相关的标记,你会得到错误的答案迪恩斯和你想要的观众都看不到这个问题。这里的每个人都在尽力提供帮助。所以没有必要单独寻求帮助。
public static void main(String[] args) {
Scanner console = new Scanner(System.in);
int studentVisitCount = 0;
System.out.print("Enter the number of lockers: ");
int x = 0;
int y = 0;
int numberOfLockers = console.nextInt();
for(int x,=0; x<=numberOfLockers; x++);
{
if(x%y==0)
{
studentVisitCount++;
}
for(int y=0; y<=x; y++)
{
if(studentVisitCount%2!=0)
{
System.out.print(y+" ");
}
}
}
System.out.println("The number of lockers and students are: "+numberOfLockers);
System.out.print("The locker numbers of lockers that are left open at the end of the game are: ");
}