/*执行命令为java Vect a.txt
a.txt是要读入的文件.编程时候报错.*/import java.io.*;
import java.util.*;
public class Vect
{
private File file;
private Vector VecX; //=new Vector();
private Vector VecY; //=new Vector();
public Vect(File o) throws IOException
{ file=o;
VecX=new Vector();
VecY=new Vector();
}
public void store() throws IOException
{
BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(file)));
String str;
while(str=br.readLine()!=null)
{
String parts[]=str.split("");
VecX.add(new Double(Double.parseDouble(parts[1])));
VecY.add(new Double(Double.parseDouble(parts[2])));
}
}
public static void main(String args[]) throws IOException
{ File f=new File(args[0]);//args[0]是要读入的文件名
Vect c=new Vect(f);
c.store();
}
}
a.txt是要读入的文件.编程时候报错.*/import java.io.*;
import java.util.*;
public class Vect
{
private File file;
private Vector VecX; //=new Vector();
private Vector VecY; //=new Vector();
public Vect(File o) throws IOException
{ file=o;
VecX=new Vector();
VecY=new Vector();
}
public void store() throws IOException
{
BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(file)));
String str;
while(str=br.readLine()!=null)
{
String parts[]=str.split("");
VecX.add(new Double(Double.parseDouble(parts[1])));
VecY.add(new Double(Double.parseDouble(parts[2])));
}
}
public static void main(String args[]) throws IOException
{ File f=new File(args[0]);//args[0]是要读入的文件名
Vect c=new Vect(f);
c.store();
}
}
改成:while((str=br.readLine())!=null)javac都通不过怎么直接就java了呢?
while((str=br.readLine())!=null)