首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

使用nextInt()等接受输入时务须注意换行符的输入

2013-10-13 
使用nextInt()等接受输入时必须注意换行符的输入参考http://stackoverflow.com/questions/19331426/for-lo

使用nextInt()等接受输入时必须注意换行符的输入

参考http://stackoverflow.com/questions/19331426/for-loop-does-not-iterate-the-way-i-want

见以下代码:

System.out.print("Enter name:");s.name = sc.nextLine();System.out.print("Enter number:");//解决方法二:s.number = Integer.parseInt(sc.nextLine());





热点排行