标签:col 数字 scanner void string static int public imp
package java05; import java.util.Random; import java.util.Scanner; public class DemoGuessnum { public static void main(String[] args) { Random r = new Random(); int randomnum = r.nextInt(100)+1; Scanner s = new Scanner(System.in); while (true){ int mynum = s.nextInt(); if (mynum>randomnum){ System.out.println("大了"); }else if(mynum <randomnum){ System.out.println("小了"); }else{ System.out.println("猜对了"); break; } } } }
标签:col 数字 scanner void string static int public imp
原文地址:https://www.cnblogs.com/spp666/p/11704764.html