day19随机声明一个数字然后在命令行猜

/*import java.util.Scanner;
import java.util.Random;
public class lianxi1{
public static void main(String[] args){
Random a=new Random();
int d =a.nextInt(100);
for(int i =0;;i++){
System.out.println("请随机输入1-100的数");
Scanner b = new Scanner(System.in);
int c = b.nextInt();
if(c==d){
System.out.println("恭喜你猜对了");
break;
}else if(c>d){
System.out.println("sorry,你猜大了");
}else if(c<d){
System.out.println("sorry,你猜小了");
}
if(i==10){
System.out.println("sorry,你猜的次数多了了");
break;
}
}
}
}*/

原文地址:https://www.cnblogs.com/hfew/p/10520784.html