I meet a problem while using Java Scanner. When I used two nextLine() in the code, and there would be two "\n" in the string entered by me via command line. I did't understand why this happen, please help.
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.Scanner;
public class TestScanner {
public static void main(String[] args) {
Scanner input = new Scanner(System.in, StandardCharsets.UTF_8.name());
int num = Integer.parseInt(input.nextLine().trim());
for (int i = 0; i < num; i++) {
System.out.print(Arrays.toString(input.nextLine().trim().split(" ")));
}
}
}
this is my input: enter image description here