The program retains the upper class, but the nested ignores. Here is the write method:

XMLEncoder object_writter = new XMLEncoder( new BufferedOutputStream( new FileOutputStream(input.nextLine()) ) ); object_writter.writeObject(currentCountainer); object_writter.close(); 

and readings:

 XMLDecoder object_reader = new XMLDecoder( new BufferedInputStream( new FileInputStream(input.nextLine()) ) ); currentCountainer = (Container) object_reader.readObject(); object_reader.close(); System.out.println("Done."); 

And here is the container code:

 public class Container<E> { static Container.node head = null; public String words = null; private class node { private E data; node next; public node () { next = null; } } public void add (E data) { if (head == null) { head = new node(); head.data = data; words = words + " " + head.data; return; } node current = head; while (true) { if (current.next == null) { current.next = new node (); current.next.data = data; words = words + " " + current.data; return; } current = current.next; } } 

    0