title: Write java objects to CSV file
body: <p>I have a project over data structures I am working on. I have a LinkedList and I need to be able to save object data to a text file</p>
  
  <p>"Create a text file that is a list of last name, first name, and email address. You may use CSV or any other delimiter"</p>
  
  <p>When I try to save the object data I get this "¬í t John" instead of just "John"</p>
  
  <p>My class(main and student, and email) implements Serializable</p>
  
  <pre><code>public class Main implements Serializable
  {
      public static void main(String[] args) throws IOException
      {
      Date date = new Date();
  
      Email e1 = new Email("js@got.com");
      Email e2 = new Email("doge@me.me");
      Email e3 = new Email("admin@microvern.com");
      Student s1 = new Student("John", "Snow", e1);
      Student s2 = new Student("Shiba", "Inu", e2);
      Student s3 = new Student("Vern", "Vern", e3);
      Student s4 = new Student("Professor", "Messer", new Email("pm@cs.net"));
      ListInterface&lt;Student&gt; linkedList = new LinkedList&lt;Student&gt;();
      linkedList.add(s1, 2); //should be pos 3
      linkedList.add(s2, 3); //should be pos 4
      linkedList.add(s3, 1); // should be pos 2
      linkedList.add(s4, 1); //should be pos 1
      System.out.println(linkedList);
      try
      {
          FileOutputStream fos = new FileOutputStream("students.txt");
          ObjectOutputStream output = new ObjectOutputStream(fos);
          output.writeObject(s1.getfirstName());
          output.close();
          fos.close();
          System.out.println("Data saved in /file/students.txt");
      } 
      catch (IOException exc) 
          {
          System.out.println("Failed to write to file!");
          exc.printStackTrace();
          }
      }
  }
  </code></pre>
  
  <p>Thanks!</p>