提供了常用的JAVA技术的示例
源代码在线查看: guessnumber.java~6~
package guessnumber; import javax.swing.UIManager; import java.awt.*; import java.io.*; public class guessnumber { //Main method public static void main(String[] args) throws IOException { int magic=30; int guess; do{ InputStreamReader ir; BufferedReader in; ir=new InputStreamReader(System.in); in=new BufferedReader(ir); System.out.println("input key is :"); String s=in.readLine(); guess=Integer.parseInt(s); if (guess!=magic) { System.out.print("wrong, "); if (guess>magic) System.out.println("too high !"); else System.out.println("too low !"); } }while(guess!=magic); System.out.print("right !"); } }