无法解析符号';输入';JAVA

无法解析符号';输入';JAVA,java,intellij-idea,while-loop,Java,Intellij Idea,While Loop,因此,我想做一个小的alround程序,包括测验等(不会粘贴整个代码,因为它包含300行基本内容),我想要一个布尔值,可以为我重复一个赌博游戏,所以当我开始时: String PlayAgain = input.nextLine(); 我得到错误:无法解析符号“input” 小游戏的代码如下: enter boolean InGame = true; while (InGame == true); System.out.println("Glückspiel

因此,我想做一个小的alround程序,包括测验等(不会粘贴整个代码,因为它包含300行基本内容),我想要一个布尔值,可以为我重复一个赌博游戏,所以当我开始时:

String PlayAgain = input.nextLine();
我得到错误:无法解析符号“input”

小游戏的代码如下:

enter  boolean InGame = true;
        while (InGame == true);

        System.out.println("Glückspiel: Wer näher an der zufälligen Zahl ist gewinnt! 1-100");
        System.out.println("Spieler Eins");
        double playerOne = scan.nextDouble();
        System.out.println("Spieler Zwei");
        double playerTwo = scan.nextDouble();

        double randomValue = Math.random() * 100.0;

        // Math.abs() ist eine Methode die den Betrag einer Zahl zurueck gibt.
        double spacingOne = Math.abs(playerOne - randomValue);
        double spacingTwo = Math.abs(playerTwo - randomValue);
        System.out.println("Die Random Zahl war " + randomValue);

        if (spacingOne < spacingTwo) {
            System.out.println("Spieler Eins hat gewonnen!");
        }

        if (spacingOne > spacingTwo) {
            System.out.println("Spieler Zwei hat gewonnen!");
        }

        if (spacingOne == spacingTwo) {
            System.out.println("Unentschieden!");
        }
        System.out.println("Wenn du nochmal spielen willst schreibe 'ja' wenn nicht 'nein'");
        String PlayAgain = input.nextLine();
        if  (PlayAgain == "Ja");
输入布尔值InGame=true;
而(InGame==true);
println(“Glückspiel:Wer näher an der zufälligen Zahl ist gewinnt!1-100”);
System.out.println(“斯皮尔勒-艾因斯”);
double player=scan.nextDouble();
System.out.println(“斯皮尔勒Zwei”);
双击two=scan.nextDouble();
双随机值=Math.random()*100.0;
//数学是一种很好的方法。
双间距=Math.abs(playerne-randomValue);
双间距wo=Math.abs(playerTwo-随机值);
System.out.println(“Die Random Zahl war”+Random value);
如果(间距小于间距wo){
System.out.println(“Spieler-Eins-hat-gewonnen!”);
}
如果(间距>间距wo){
System.out.println(“Spiler Zwei hat gewonnen!”);
}
if(spacingOne==spacingTwo){
System.out.println(“unnetchieden!”);
}
System.out.println(“Wenn du nochmal spielen willst schreibe‘ja’Wenn nicht‘nein’”);
字符串playtaline=input.nextLine();
如果(再次播放=“Ja”);
你能帮我吗?

也许你错过了

扫描仪输入=新扫描仪(System.in)

或者将
input
更改为
scan

String PlayAgain = scan.nextLine();
也许你错过了

扫描仪输入=新扫描仪(System.in)

或者将
input
更改为
scan

String PlayAgain = scan.nextLine();

变量
scan
与用于存储用户输入的变量类似。我建议你用这个


或者声明
Scanner input=new Scanner(System.in)
,因为我在您发布的代码中看不到它

变量
scan
看起来像是用于存储用户输入的变量。我建议你用这个


或者声明
Scanner input=new Scanner(System.in)
,因为我在您发布的代码中看不到它

您在哪里声明
input
?尝试以下操作:
String playreach=scan.nextLine()请接受对您有帮助的答案之一。您在哪里声明了
input
?尝试以下操作:
String playreach=scan.nextLine()请接受帮助您的答案之一。