【发布时间】:2018-03-28 08:57:18
【问题描述】:
import java.util.*;
public class MovieInfo
{
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
System.out.println("Enter the name of the film");
String name = in.nextLine();
System.out.println("Enter the film budget");
int bud = in.nextInt();
System.out.println("Enter the running time");
double time = in.nextDouble();
System.out.println("Enter the film production house");
String s1 = in.nextLine();
System.out.println("Film being screened : "+name);
System.out.println("Budget "+bud+" cores");
System.out.println("Running time "+time+" hours");
System.out.println("Production : "+s1);
}
}
在上述程序的输出中,它不接受字符串 s1 的输入。 我如何解决它? 任何帮助将不胜感激。
【问题讨论】:
-
你到底是什么意思?你的输入是什么?你的打印语句打印什么?
-
在您的系统中运行上述程序。我们可以输入字符串名称、int bud、double time,但是当涉及到下一行时,它只会打印“进入电影制作公司”并终止程序。它没有对字符串 s1 进行任何输入。 @Stultuske
标签: java string java.util.scanner