import java.util.Random;
import java.util.Scanner;
public class Guess {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
Random r = new Random();
int remp = r.nextInt(100);
System.out.print("输入一个数");
int x = sc.nextInt();
if(x
} else if(x == temp) {
System.out.println("相等");
} else {
System.out.println("大了");
}
}
}
好像是这样
Random r = new Random();
int a = r.nextInt(100);//100以内的随机数
用随机函数random 去试着自己写一下,写出来后挺舒服的
你的temp写错了