public class Solution {
public static void main(String[] args) {
int i = 4;
double d = 4.0;
String s = "HackerRank ";
Scanner scan = new Scanner(System.in);
/* Declare second integer, double, and String variables. */
/* Read and save an integer, double, and String to your variables.*/
int sec = scan.nextInt();
double db = scan.nextDouble();
String newWord = scan.nextLine();
/* Print the sum of both integer variables on a new line. */
System.out.println(i + sec);
/* Print the sum of the double variables on a new line. */
System.out.println(d + db);
/* Concatenate and print the String variables on a new line;
the 's' variable above should be printed first. */
System.out.println(s + newWord);
scan.close();
}
}
If String newWord = scan.nextLine();
is placed before int sec = scan.nextInt();
it works fine though.