import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.List;
public class RF{
public static void main(String[] args) throws IOException{
int count = 0;
FileReader fr = new FileReader("file.txt");
BufferedReader br = new BufferedReader(fr);
String line;
while ((line = br.readLine()) != null){
//System.out.println(br.readLine());
count++;
}
String []readArray = new String[count];
for(int i = 0; i < readArray.length; i++){
readArray[i] = br.readLine();
System.out.println(readArray[i]);
}
}
}
我无法将文本文件中的数据写入新数组,数组永远不会被填充。我只需要将这些数据写入数组,然后删除一些项目并吐出一个新的文本文档