title: How can I serialize an interface?
body: <p>Suppose I have a <code>Serializable</code> class <code>ShapeHolder</code> that owns an object that implements a <code>Serializable</code> <code>Shape</code> interface.  I want to make sure the correct concrete shape object is saved (and the correct type is later restored). </p>
  
  <p>How can I accomplish this?</p>
  
  <pre><code>interface Shape extends Serializable {} 
  
  class Circle implements Shape { 
     private static final long serialVersionUID = -1306760703066967345L;
  }
  
  class ShapeHolder implements Serializable {
     private static final long serialVersionUID = 1952358793540268673L;
     public Shape shape;
  }
  </code></pre>