In this snippet what I am doing taking three different types of variables and adding them and then printing then down.
 public static void main(String[] args) {
    int i = 4;
    double d = 4.0;
    String s = "HackerRank ";
    Scanner scan = new Scanner(System.in);      
    int firstVariable = 0;
    double secondVariable = 0.0;       
    String theString = "";
    firstVariable = scan.nextInt();
    secondVariable = scan.nextDouble();
    theString = scan.nextLine();
    System.out.println(firstVariable+i);
    System.out.println(secondVariable+d);
    System.out.println(s+""+theString);
}
I am providing input for firstVariable hitting enter and then providing the input for secondVariable and now as soon as I hit enter theString is capturing that value(I know it should capture it).
EDIT: in this case how should I provide the input to theString without as well as with space ?
I did try something like this,
    while(scan.hasNext())
        theString = scan.nextLine();
But it didn't work either.
 
     
     
    