Coding Global Background
Coding Global

Java BufferedWriter problem

Archiviert 3 years ago
3 Nachrichten
0 Mitglieder
Erstellt 3 years ago
Aktualisiert 3 years ago
In Discord öffnen
T
terrylamarr
I'm trying to make a data saving system and it reads in the data perfectly fine but only if I delete the writeData method. It seems as though writeData is being called somehow and writing null to the file even though I have not done se anywhere in my code.
I am only called readData.
public static void readData() {
        try {
            String[] line = in.readLine().split(",");
            System.out.println(line);
            count = Integer.parseInt(line[0]);
        } catch(IOException e) {
            e.printStackTrace();
        }
    }
    
    public static void writeData() {
        try {
            out.write(count);
            out.flush();
        } catch(IOException e) {
            e.printStackTrace();
        }
    }

Antworten (3)