multiple fileWriters

Hi,

I'm trying to write 2 vectors to two different files and i'm not sure if it's possible.

my code works fine when i write the 1st vector to a file (with the second filewriter commented out) but when i try to write the second vector i get this error:

Split.java:64: cannot resolve symbol

symbol : constructor FileWriter (java.util.Vector)

location: class java.io.FileWriter

FileWriter out2 = new FileWriter(Test);

^

1 error

here is a snippet of my code

publicstaticvoid main(String[] args)

{

Vector Train;

Vector InnerVec =new Vector();

Split s =new Split();

Vector data = s.readFile("diabetes.txt");

Vector Test = s.split(data);

System.out.println("test sie" +Test.size());

Train = s.getTrainingVector();

System.out.println("train sie" +Train.size());

try

{

File Training =new File("Training.txt");

FileWriter out =new FileWriter(Training);

for(int i =0; i<Train.size(); i++)

{

InnerVec = (Vector)Train.elementAt(i);

for(int j =0; j><InnerVec.size(); j++)

{

out.write(""+(Float)(InnerVec.get(j)));

out.write(",");

out.write(" ");

}

out.write("\n");

}

out.close();

}

catch(IOException e)

{

System.exit(0);

}

try

{

File Testing =new File("Test.txt");

FileWriter out2 =new FileWriter(Test);

for(int i =0; i><Test.size(); i++)

{

InnerVec = (Vector)Test.elementAt(i);

for(int j =0; j><InnerVec.size(); j++)

{

out2.write(""+(Float)(InnerVec.get(j)));

out2.write(",");

out2.write(" ");

}

out2.write("\n");

}

out2.close();

}

catch(IOException e)

{

System.exit(0);

}

can anybody help?

Cheers>

[3370 byte] By [elodiea] at [2007-10-2 12:36:37]
# 1

Should

File Testing = new File("Test.txt");

FileWriter out2 = new FileWriter(Test);

not be

File Testing = new File("Test.txt");

FileWriter out2 = new FileWriter(Testing); // use File and not Vector 'Test' here!

m

yorkroada at 2007-7-13 9:37:42 > top of Java-index,Java Essentials,New To Java...
# 2
thankyou.you know when you've been looking at something for so long you can't see the obvious.:)
elodiea at 2007-7-13 9:37:42 > top of Java-index,Java Essentials,New To Java...