Hallo, versuche Daten aus einem Vector in eine Textdatei zu schreiben.
Leider klappt das irgendwie nicht. Der Compiler liefert mir eine ganze Reihe an Fehlermeldungen zurück:
non-static variable vector cannot be referencend from a static context
cannot find symbol method write (java.util.Vector)
incompatible types
Hat jemand eine Idee was ich alles machen muß damit das ganze funktioniert?
Code:
import java.io.FileWriter;
import java.io.IOException;
import java.util.*;
public class Fussballerspeichern {
private Vector vector = new Vector();
public static void main (Vector args[]) {
FileWriter file = null;
try {
file = new FileWriter("Fussballer.txt");
Vector text =
vector.addElement (new String ("1; Kahn; Oliver; 15.06.1969\n"));
vector.addElement (new String ("22; Rensing; Michael; 14.05.1984\n"));
vector.addElement (new String ("36; Schlösser; Jan; 27.09.1982\n"));
vector.addElement (new String ("2; Sagnol; Willy; 18.03.1977\n"));
file.write(text);
file.close();
}
catch (IOException ex) {
System.out.println(ex);
}
}
}
non-static variable vector cannot be referencend from a static context
cannot find symbol method write (java.util.Vector)
incompatible types
Hat jemand eine Idee was ich alles machen muß damit das ganze funktioniert?