关于nextLine的问题

Zjut_Tablo 2011-11-01 10:45:05
System.out.println("Please describe the food you have:");
String s2=mysc.nextLine();
System.out.println("What is the volume of the food you have (in millilitres)?");

结果:
Please describe the food you have:
What is the volume of the food you have (in millilitres)?

问题:他直接两条输出语句都给我输出了。
我的目的是请输出第一行,然后输入食物的描述(中间会用到空格),然后再输出第三行。

不使用IO能解决这个问题吗?
...全文
46 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

23,407

社区成员

发帖
与我相关
我的任务
社区描述
Java 非技术区
社区管理员
  • 非技术区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧