title: Implementing an ArrayQueue in java need toString method
body: <p>I have an <code>ArrayQueue</code> I am implementing for a class in the java language.</p>
  
  <p>I am storing transaction objects in the <code>ArrayQueue</code> and I am getting stuck at the <code>display()</code> method (aka my own <code>toString()</code>). But it is only returning the reference.</p>
  
  <p>Here is my method:</p>
  
  <pre><code>//display the elements in the current queue
  public String display() {
  
    String result = "";
  
    if(isEmpty()) {
          throw new EmptyQueueException("Queue is empty.");
    } else {
       for (int i = 0; i &lt; count; i++) {
         result += "[" + Q[(front + i) % capacity] + "] ";
       }
    }
  
    return result;
  }
  </code></pre>
  
  <p>Does this mean I need a <code>toString()</code> method for my object and call it like: <code>System.out.println(arrayqueue.display().toString())</code>?</p>