S
sqf168
Unregistered / Unconfirmed
GUEST, unregistred user!
我想把从文本文件里读的一行一行数据保存到数组为什么有错误
import java.io.*;
import java.util.*;
public class TestFile2
{
public static void main(String[] args) throws IOException
{
BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream("Filerd.txt"));
String data = null;
String[] d=null;
int j=0;
while((data = br.readLine())!=null)
{
d[j]=data;
System.out.println(d[j]);
j++;
}
br.close();
}
}
import java.io.*;
import java.util.*;
public class TestFile2
{
public static void main(String[] args) throws IOException
{
BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream("Filerd.txt"));
String data = null;
String[] d=null;
int j=0;
while((data = br.readLine())!=null)
{
d[j]=data;
System.out.println(d[j]);
j++;
}
br.close();
}
}