Ich versuche, Zeilen aus einer Textdatei in einem Array zu speichern, das kein String-Array ist. Der Rückgabetyp sollte ein GO-Array sein (habe eine andere Klasse mit dem Namen „GO“ mit Konstrukteuren erstellt und get-/set-Methoden, die ich in anderen Teilen des Codes verwenden werden.)Textdatei in nicht-String-Array speichern
int rad = 0;
GO [] list = new CD [rad];
public GO[] readFile(String filename) throws FileNotFoundException {
Scanner read = new Scanner (new File(filename));
while (read.hasNextLine()==true){
rad++;
read.nextLine();
} read.close();
read = new Scanner(new File(filename));
for (int i=0;i<list.length;i++){
//here the lines of the file should be stored in the "GO"array
// but the declaration cannot convert string to GO[]
list[i]=read.nextLine()
'== wahr in der Logik ist redundant. Es ist wie '* 1' oder' +0'. – Pshemo
Und deine Frage ist? – gfelisberto
Edit: es soll "GO [] Liste = neue GO [Rad]" –