//猜数字小游戏 public class HelloWorld { public static void main(String[] args) { Random r=new Random(); int number= r.nextInt(100)+1; Scanner sc=new Scanner(System.in); System.out.println("请输入你要猜的数字"); int gussNumber=sc.nextInt(); if(gussNumber>number){ System.out.println("猜大了"); }else if(gussNumber<number){ System.out.println("猜小了"); }else{ System.out.println("猜中了"); } } }