JDK5.0中从控制台窗口读取输入的简便方法
taohuanteng
2007-03-29
import java.util.*;
public class InputTest { Scanner in=new Scanner(System.in);//这个类是5.0新增加的为了简化控制台的输入 System.out.println("what is your name?"); String name=in.netLine(); System.out.println("how old are you?"); int age=in.netInt(); System.out.println("Hello"+name+",next year ,you'll be"+(age+1)); } |
|
rockjava
2007-03-29
笨狗你终于来发帖子了,呵呵
|