The code I have written takes as input just a single string and not a whole sentence and I want a whole sentence to be taken as input:
import java.util.Scanner;
public class Solution {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int i;
i= scan.nextInt();
double d;
d=scan.nextDouble();
String s;
s=scan.next();
System.out.println("String: " + s);
System.out.println("Double: " + d);
System.out.println("Int: " + i);
}
}
The test case is "Welcome to Java" and it's just showing "Welcome" in the output. Everything else is working fine. Please help.