从控制台获取输入

Scanner scanner=new Scanner(System.in);  //这整行创建一个Scanner对象,并且将它指向变量Scanner

Scanner对象包括以下读取输入的方法:

.next()

.nextByte()

.nextShort()

.nextInt()

.nextLong()

.nextFloat()

.nextDouble()

posted @ 2011-06-09 19:53  爱无限  阅读(192)  评论(0编辑  收藏  举报