使用String下的split()方法,括号中为分隔符。例如,“32 45 67 43 26”将被转化为 [32,45,67,43,26](Sting[])。
public static void main(String[] args) throws IOException {
BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
int num= Integer.parseInt(input.readLine());
for(int i=0;i<num;i++) {
String s1=input.readLine();
String str1[] = s1.split(" ");
String str2[] = s2.split(" ");
}
}