展开全部
数组的动态性不好。建议先用List,若需要,再转32313133353236313431303231363533e59b9ee7ad9431333335333031化为二维数组public class $ {
public static void main(String[] args) {
List data = new ArrayList<>();
try {
Scanner in = new Scanner(new File("D:/a.txt"));
while (in.hasNextLine()) {
String str = in.nextLine();
data.add(str.split(" ,|"));
}
} catch (Exception e) {
e.printStackTrace();
}
// list转化为数组
String[][] result = data.toArray(new String[][] {});
for (String[] strings : result) {
for (String string : strings) {
System.out.print(string + " ");
}
System.out.println();
}
}
}