title: ObjectOutput throws java.io.NotSerializableException
body: <p>This is the class that's about to be serialized into a byte array.</p>
  
  <pre><code>public class DummyClass implements Serializable
  {
      private static transient final long serialVersionUID    = -8483859843874771619L;
      public String   y;
  
      public DummyClass(String y)
      {
          this.y = y;
      }
      public String getY()
      {
          return this.y;
      }
  }
  </code></pre>
  
  <p>This is the Serialization execution test</p>
  
  <pre><code>    ByteArrayOutputStream bos = new ByteArrayOutputStream();
      ObjectOutput out = null;
      byte[] bs = null;
      try
      {
          DummyClass dummyClass = new DummyClass("World I Salute you");
          out = new ObjectOutputStream(bos);
          out.writeObject(dummyClass); // &lt;--- Throws exception here
          bs = bos.toByteArray();
      }
      finally
      {
          out.close();
          bos.close();
      }
  </code></pre>
  
  <p>and regarding the stack trace:</p>
  
  <pre><code>java.io.NotSerializableException: tests.DummyClassTest
  at java.io.ObjectOutputStream.writeObject0(Unknown Source)
  at java.io.ObjectOutputStream.defaultWriteFields(Unknown Source)
  at java.io.ObjectOutputStream.writeSerialData(Unknown Source)
  at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)
  at java.io.ObjectOutputStream.writeObject0(Unknown Source)
  at java.io.ObjectOutputStream.writeObject(Unknown Source)
  at tests.DummyClassTest.dummyTest(DummyClassTest.java:109)
  </code></pre>
  
  <p>The Obvious question is what am i doing wrong?</p>
  
  <p>Cheers.</p>
  
  <p><strong>EDIT</strong>:</p>
  
  <p>The whole Class</p>
  
  <pre><code>public class DummyClassTest
  {
      public class DummyClass implements Serializable
      {
          private static transient final long serialVersionUID    = -8483859843874771619L;
          public String   y;
  
          public DummyClass(String y)
          {
              this.y = y;
          }
          public String getY()
          {
              return this.y;
          }
      }
  
      @Test
      public void dummyTest() throws IOException
      {
          ByteArrayOutputStream bos = new ByteArrayOutputStream();
          ObjectOutput out = null;
          byte[] bs = null;
          try
          {
              DummyClass dummyClass = new DummyClass("World I Salute you");
              out = new ObjectOutputStream(bos);
              out.writeObject(dummyClass);
              bs = bos.toByteArray();
          }
          finally
          {
              out.close();
              bos.close();
          }
      }
  }
  </code></pre>