You want to put the second input line – to take the configuration1
into a for loop to run T
number of times and display it.
public static void main(String[] args) {
int T, N;
System.out.println("Enter number of test cases: ");
Scanner in = new Scanner(System.in);
T = in.nextInt();
String configuration1;
for (int i = 0; i < T; i++) {
System.out.println("Enter the configuration: ");
configuration1 = in.next();
System.out.println("The configuration is: " + configuration1);
}
}
Then the output will be
Enter number of test cases:
3
Enter the configuration:
10
The configuration is: 10
Enter the configuration:
20
The configuration is: 20
Enter the configuration:
30
The configuration is: 30
solved Control is not waiting to read for string object