标签:public code tin ring color static rgs exti out
Java源代码如下:
public class Demo01 { public static void main(String[] args) { game(); } static void game(){ int numRandom = new Random().nextInt(100)+1; Scanner sc = new Scanner(System.in); System.out.println("请输入你猜的数字:"); while(true) { int numScanner = sc.nextInt(); if(numRandom>numScanner){ System.out.println("数字小了,重新输入"); }else if(numRandom<numScanner){ System.out.println("数字大了,重新输入"); }else { System.out.println("恭喜你,猜中了"); break; } } } }
标签:public code tin ring color static rgs exti out
原文地址:https://www.cnblogs.com/9-King/p/13362614.html