/** @param args */ public static void main(String[] args) { Original o = new Original("egg"); Storage s = new Storage(o.createMemento()); System.out.println("original the value is:" + o.getValue()); o.setValue("cat"); System.out.println(o.getValue()); o.restoreMemento(s.getMemento()); System.out.println(o.getValue()); }