java基础之输入语句

1.使用Scanner

Scanner sc = new Scanner(System.in);

如果要输入整数,则 int n = sc.nextInt();
String类型的,则String temp = sc.next();

2.使用BufferedReader

BufferedReader br = new BufferedReader( new InputStreamReader(System.in) );
String input = br.readLine();

posted @ 2013-05-06 15:12  NW_KNIFE  阅读(5040)  评论(0编辑  收藏  举报