@@ -0,0 +1,1569 @@
+package com.javarush.task.task20.task2022;%0A%0Aimport java.io.*;%0A%0A/* %0A%D0%9F%D0%B5%D1%80%D0%B5%D0%BE%D0%BF%D1%80%D0%B5%D0%B4%D0%B5%D0%BB%D0%B5%D0%BD%D0%B8%D0%B5 %D1%81%D0%B5%D1%80%D0%B8%D0%B0%D0%BB%D0%B8%D0%B7%D0%B0%D1%86%D0%B8%D0%B8 %D0%B2 %D0%BF%D0%BE%D1%82%D0%BE%D0%BA%D0%B5%0A*/%0Apublic class Solution implements Serializable, AutoCloseable %7B%0A    transient private FileOutputStream stream;%0A    private String fileName;%0A%0A    public Solution(String fileName) throws FileNotFoundException %7B%0A        this.stream = new FileOutputStream(fileName);%0A        this.fileName = fileName;%0A    %7D%0A%0A    public void writeObject(String string) throws IOException %7B%0A        stream.write(string.getBytes());%0A        stream.write(%22%5Cn%22.getBytes());%0A        stream.flush();%0A    %7D%0A%0A    private void writeObject(ObjectOutputStream out) throws IOException %7B%0A        out.defaultWriteObject();%0A%0A    %7D%0A%0A    private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException %7B%0A        in.defaultReadObject();%0A        stream = new FileOutputStream(fileName, true);%0A    %7D%0A%0A    @Override%0A    public void close() throws Exception %7B%0A        System.out.println(%22Closing everything!%22);%0A        stream.close();%0A    %7D%0A%0A    public static void main(String%5B%5D args) throws IOException, ClassNotFoundException %7B%0A        Solution solution = new Solution(%22e:%5C%5Cshalom.txt%22);%0A        solution.writeObject(%22Shalom!%5Cr%5Cn%22);%0A        ObjectOutputStream oos= new ObjectOutputStream(new FileOutputStream(%22e:%5C%5Csolution.obj%22));%0A        oos.writeObject(solution);%0A%0A        ObjectInputStream ois = new ObjectInputStream((new FileInputStream(%22e:%5C%5Csolution.obj%22)));%0A        Solution solution2 = (Solution) ois.readObject();%0A        solution2.writeObject(%22Shalom again!%22);%0A%0A    %7D%0A%7D

Task --> 2022