java中从键盘上读取数的example

一个小的example:

 // Programming with Java by lison.nie import java.io.*; public class HelloAl { public static void main(String[] args) throws IOException { InputStreamReader reader = new InputStreamReader(System.in); BufferedReader input = new BufferedReader(reader); System.out.print("Enter your name: "); String name = input.readLine(); System.out.println("Hello, " + name + "!"); } }

你可能感兴趣的:(java,String,Class,input)