Java System.out.println-语法错误

Java System.out.println-语法错误,java,Java,这里是Java初学者 试图找出为什么在最后两个System.out.println上出现语法错误 我试着移动我的括号,但我最终得到了一个永无止境的循环 我提前感谢你的帮助 import java.util.Scanner; 公开课猜谜游戏 { 公共静态void main(字符串参数[]) { 扫描仪扫描=新扫描仪(System.in); int random=(int)(Math.random()*20+1); int numberofthresents=0; 布尔赢=假; while(win

这里是Java初学者

试图找出为什么在最后两个System.out.println上出现语法错误

我试着移动我的括号,但我最终得到了一个永无止境的循环

我提前感谢你的帮助


import java.util.Scanner;
公开课猜谜游戏
{
公共静态void main(字符串参数[])
{
扫描仪扫描=新扫描仪(System.in);
int random=(int)(Math.random()*20+1);
int numberofthresents=0;
布尔赢=假;
while(win==false)
System.out.println(“猜数字(1-20)”;
int guess=scan.nextInt();
尝试次数++;
如果(猜测==随机)
赢=真;
else if(猜测<随机)
System.out.println(“你的猜测很低,再猜一次。”);
其他的
System.out.println(“你的猜测很高,再猜一次。”);
}
System.out.println(“你猜对了!你猜对了。”);
System.out.println(“您想再次播放吗?(是或否)”;
}

您没有打开while循环。过一会儿你需要括号

while (win == false){
//need one at the beginning 

        System.out.println("Guess the number (1 - 20)");
        int guess = scan.nextInt();
        numberOfAttempts++;

        if (guess == random)
            win = true;
        else if (guess < random)
            System.out.println("Your guess was low. Guess again.");
        else
            System.out.println("Your guess was high. Guess again.");
} //and at the end
while(win==false){
//一开始就需要一个
System.out.println(“猜数字(1-20)”;
int guess=scan.nextInt();
尝试次数++;
如果(猜测==随机)
赢=真;
else if(猜测<随机)
System.out.println(“你的猜测很低,再猜一次。”);
其他的
System.out.println(“你的猜测很高,再猜一次。”);
}//最后呢

您应该正确缩进代码。while循环的主体是什么?由于印刷错误,投票结束。谢谢。我仍在努力解决缩进问题。while循环的主体应该是猜游戏执行的“猜数字”。1。为每个for/if/while/method/switch/class/etc使用大括号。数一数你的大括号,每个开始的大括号都应该有一个结束的大括号brace@Absurd-小心,谢谢。我忘了我需要放支架。我正在标记为已解决,但自从我打开此个人帐户以来,我处于Stackoverflow超时状态。:)好极了多谢各位。仅在本Java课程的第3周!标记为已解决。
while (win == false){
//need one at the beginning 

        System.out.println("Guess the number (1 - 20)");
        int guess = scan.nextInt();
        numberOfAttempts++;

        if (guess == random)
            win = true;
        else if (guess < random)
            System.out.println("Your guess was low. Guess again.");
        else
            System.out.println("Your guess was high. Guess again.");
} //and at the end