源代码如下,自己运行下:
import java.io.BufferedReader;
import java.io.FileReader;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JFrame;
public class Test extends JFrame
{
static List
static List
static List
public static void main(String[] args) throws Exception
{
BufferedReader in = new BufferedReader(new FileReader("1.txt"));// 这里"1.txt"是文件名,因此要按实际情况修改
String ss = "";
while ((ss = in.readLine()) != null)
{
String[] s = ss.split(" ");
x.add(Double.parseDouble(s[0]));
y.add(Double.parseDouble(s[1]));
z.add(Double.parseDouble(s[2]));
}
System.out.println(x);
System.out.println(y);
System.out.println(z);
in.close();
}
}
都一样 读取文本文件 最好用readLine 读完之后对每个字符串分割处理