title: Formatting Output in Java from ArrayList
body: <p>I'm trying to format my output of Marks from 2 different <code>ArrayList</code>s. One for <code>Homework</code>, another for <code>Exams</code>. The format I'm looking for is something like this:</p>
  
  <p><img src="https://i.stack.imgur.com/vGZqA.png" alt="enter image description here"></p>
  
  <p>My Code so far is </p>
  
  <pre><code>public void example() {
        System.out.println("");
        System.out.println("Subject: "+subjectString);
        System.out.print("Homework Mark: ");
        for(int i = 0; i &lt;= arrayList1.size()-1; i++){
            System.out.printf("",arrayList1.get(i));
         }
      }
  }
  </code></pre>
  
  <p>But I cannot get it to work in any way.</p>