请帮帮我。 Eclipse表示在if子句中是一个错误。我不允许使用的println那里 如果(eingabe = Z1) 也是一大错误(eingabe = Z1)是红色无法使用System.out.println();
import java.util.*;
import java.util.Scanner;
public class Benedikt {
public static void main(String[] args){
Random zufall = new Random();
int eingabe;
Scanner leser1= new Scanner (System.in);
int z1;
z1 = zufall.nextInt(6)+1;
System.out.println("I have got a number between 1 and 6 in my mind. %n");
System.out.println("Try to guess it!");
//Eingabe
eingabe=leser1.nextInt(eingabe);
if (eingabe=z1){
System.out.println("You have found out the number! My number was %d",z1);
} else if(eingabe > z1){
System.out.println("My number is smaller than %d", eingabe);
} else if (eingabe<z1){
System.out.println("My number is smaller than %d", eingabe);
}
}
}
'eingabe = z1'是赋值。 –
@GhostCat:有'main' – Blasanka