0
我的输入将是提供在Java中使用扫描仪输入的多行
12
4.0
has to be concatenated with this input
我的预期输出是
16
8.0
RandomString has to be concatenated with this input
如下
我它试图做到这一点是代码
int i = 4;
double d = 4.0;
String s = "RandomString";
Scanner scan = new Scanner(System.in);
int j = scan.nextInt();
double e = scan.nextDouble();
String str = scan.nextLine();
int resInt = i + j; double resDouble = d + e; String resString = s +" "+ str;
System.out.println(resInt);
System.out.println(resDouble);
System.out.println(resString);
scan.close();
这表现有所不同。只要我输入两行输入,它就会给我输出。不等待我的输入的第三行。所以现在我的输出是
12
4.0
16
8.0
RandomString