Can someone pls tell me, what I have to do next. I can't understand the task, meaby there is a mistake in the polish translation.
package pl.codegym.task.task20.task2022;
import java.io.*;
/*
Nadpisywanie serializacji w wątku
*/
public class Solution implements Serializable, AutoCloseable {
private transient FileOutputStream stream;
public Solution(String fileName) throws FileNotFoundException {
this.stream = new FileOutputStream(fileName);
}
public void writeObject(String string) throws IOException {
stream.write(string.getBytes());
stream.write("\n".getBytes());
stream.flush();
}
private void writeObject(ObjectOutputStream out) throws IOException {
out.defaultWriteObject();
}
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();
}
@Override
public void close() throws Exception {
System.out.println("Zamykanie wszystkiego!");
stream.close();
}
public static void main(String[] args) {
try {
Solution solution = new Solution("C:\\Users\\Dominik K\\Desktop\\save.ser");
solution.writeObject("A");
ObjectOutputStream output = new ObjectOutputStream(solution.stream);
solution.writeObject(output);
FileInputStream fileInput = new FileInputStream("C:\\Users\\Dominik K\\Desktop\\save.ser");
ObjectInputStream input = new ObjectInputStream(fileInput);
}catch (FileNotFoundException e){ e.printStackTrace(); }
catch (IOException e){ e.printStackTrace(); }
}
}