I'm stuck trying to write a loop through an array for results in a toString
<pre><code>/**
     * get a formatted string with information about a competition.
     * 
     * @return String String with information about a competition.
     * 
     * The output should be in the following format:
     * &lt;pre&gt;
     * Rodent's Information:
     * Rat RFID 787878787
     * Gender: F
     * Vaccination status: false
     * 
     * Maze Information:
     * Start Time: 00:00:00
     * End Time: 01:00:05
     * Actual Time: 01:00:05
     * Contest Time: 00:59:30
     * &lt;/pre&gt;
     * 
     */
    public String toString()
    {
        // your code here, replace the "X" and -9 with appropriate
        // references to instance variables or calls to methods
        String output = "Competition Description: " + this.desc
            + "\nCompetition Count: " + this.count + "\n";
        output += "Competition Results:" + "\n";
        // loop through the array from beginning to end of populated elements
        for (int i = 0; i &lt; this.nextPos; ++i)
        {
            this.results[i].getRFID();
            this.results[i].getGender();


            // get toString() for each result


        return output;
    }
</code></pre>

<p>Hi everyone,
I've been stuck on writing this toString for a couple of days now. Can someone please help me figure out how to write a loop for showing all the elements in the array from beginning to end. I just keep coming up stuck. As you can see, I have started writing a loop but now I have no clue if it is started out right. Thanks!</p>
