1.以前好像碰到过这种问题,没有记录,长时间没用导致这个坑再次出现
public class Test {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int temp = sc.nextInt();
List<String> list = new ArrayList<>();
sc = new Scanner(System.in);//没有这句,输入字符串个数为1,直接结束
for (int i = 0; i < temp; i++) {
String s = sc.nextLine();
list.add(s);
}
int index = 0;
for (int i = 0; i < temp; i++) {
String t = list.get(i);
index = t.indexOf(" ");
StringBuilder tt = new StringBuilder();
tt.append(t.substring(index+1)+" "+t.substring(0, index));
System.out.println(tt);
tt.delete(0,tt.length());
}
}
}