📜  如何在java代码示例中将文本文件中的列划分为单独的数组

📅  最后修改于: 2022-03-11 14:52:10.550000             🧑  作者: Mango

代码示例1
Scanner scanner = new Scanner(new File(file));
ArrayList animalData = new ArrayList();
while (scanner.hasNext()) {
    String[] columns = scanner.nextLine().split("/t");
    String data = columns[columns.length-1];
    animalData.add(data);
    System.out.println(data);
}

int size = animalData.size();
String[] arr1 = new String[size]; String[] arr2 = new String[size]; 
String[] arr3 = new String[size]; String[] arr4 = new String[size];
for(int i=0;i