As a training exercise, I have to take user input for a guess they will make, which consists of 4 integers. So far, I've written this:
// IV. The computer asks the user to guess the 4-tuples. The user input must
// be in the same line as the question, a space between each two numbers, and
// an enter after the last one (as shown in the example).
System.out.print("Iteration 1. Next guess: ");
int Guess1 = x.nextInt();
System.out.print(" ");
int Guess2 = x.nextInt();
System.out.print(" ");
int Guess3 = x.nextInt();
System.out.print(" ");
int Guess4 = x.nextInt();
System.out.println(" ");
The output is receive, however, is as follows:
Iteration 1. Next guess: 1
2
2
2
Even though I'm using the "print" function instead of "println" function, it seems to go to next line when an input is given by the user. Any ideas to make sure the input numbers show up in the console on the same line? So like this:
Iteration 1. Next guess: 1 2 2 2