title: Formatting Java Output Like a Table
body: <p>I am attempting to output information regarding students stored by my program in a tabular-like format as \t does not always provide the correct spacing. In order to do so, I came across <a href="https://stackoverflow.com/a/2745239/1692226">this question</a> and have attempted to enable a similar solution. However, I am obtaining errors with the format lines in my code when I attempt to execute it as such.</p>
  
  <pre><code>public void displayStudents (){
      System.out.println ("\n-----------------------------");
      System.out.println ("Email System - Display Students");
      System.out.println ("-----------------------------");
      System.out.format("%10s%15d%15s%15s%20s", "Grade", "Last Name", "First Name", "Student Number", "Parent Email");
  
      StudentNode current = top;
      while (current != null){
          Student read = current.getStudentNode();
          System.out.format ("%10s%15d%15s%15s%20s", ""+read.getClass(), read.getLastName(), read.getFirstName(), ""+read.getStudentNum(), read.getParentEmail());
          //This will output with a set number of character spaces per field, giving the list a table-like quality
      }
  }//End of displayStudents
  </code></pre>
  
  <p>The goal of the code is to output in a manner similar to the following image.
  <img src="https://i.stack.imgur.com/FEjWU.png" alt="enter image description here"></p>
  
  <p>Please aid me in finding my error. Is there perhaps an alternatively method to perform this?</p>
  
  <p>Thanks.</p>
  
  <p>EDIT: The error(s) I am getting are</p>
  
  <pre><code>GradeException in thread "main" java.util.IllegalFormatConversionException: d != java.lang.String
  at java.util.Formatter$FormatSpecifier.failConversion(Unknown Source)
  at java.util.Formatter$FormatSpecifier.printInteger(Unknown Source)
  at java.util.Formatter$FormatSpecifier.print(Unknown Source)
  at java.util.Formatter.format(Unknown Source)
  at java.io.PrintStream.format(Unknown Source)
  at StudentList.displayStudents(StudentList.java:184)
  at OnlineCommunications.emailOption(OnlineCommunications.java:403)
  at OnlineCommunications.main(OnlineCommunications.java:451)
  </code></pre>
  
  <p>It should be noted that Grade is an integer and Long is a double.</p>