title: How to implement Serializable?
body: <p>How should I <code>implement</code> the <code>Serializable</code> interface? </p>
  
  <p>I have a <code>class</code> <code>Student</code>, and  need to be able to save it to disk. For my homework, I have to serialize five different <code>Student</code> objects and save them to file.</p>
  
  <pre><code>class Student {
       String mFirstName;
       String mSecondName;
       String mPhoneNumber;
       String mAddress;
       String mCity;
  
  Student(final String pFirstName, final String pSecondName, final String pPhoneNumber, final String pAddress, final String pCity){
      this.mFirstName = pFirstName;
      this.mSecondName = pSecondName;
      this.mPhoneNumber = pPhoneNumber;
      this.mAddress = pAddress;
      this.mCity = pCity;
  
  }}
  </code></pre>
  
  <p>I've tried using <code>ObjectOutputStream</code> to serialize a <code>Student</code>, but it throws an error:</p>
  
  <pre><code>ObjectOutputStream lOutputStream = new ObjectOutputStream(new FileOutputStream("file.txt", true));
  lOutputStream.write(new Student("foo","bar","555-1234","Flat 40","Liverpool"));
  </code></pre>