Java MP3 Loop ArrayList
<p>So this is for a school assignment, but I've been working at it for a couple hours now and I've lost hope. The idea of the assignment was to create a main MP3 Class, then using another class Titled MP3Collection, create new MP3 objects and add them to an ArrayList, then later print them out numbered and with all data. </p>

<p>I've having issues trying to figure out how to loop and print the values of the ArrayList</p>

<p>Here is the code for MP3.java, although it's just mainly getting and setting functions.</p>

<pre><code>    public class MP3 {

    //Initiate Variables
    private String artist;
    private String song;
    private String album;
    private int trackLength;

    //Constructor
    public MP3(String artistName, String songName, String albumName, int trackLeng){
        setArtist(artistName);
        setSong(songName);
        setAlbum(albumName);
        setLength(trackLeng);
    }

    //**** Set Functions ****

    //Set Artist
    public void setArtist(String artistName){ artist = artistName; }

    //Set Song
    public void setSong(String songName){ song = songName; }

    //Set Album
    public void setAlbum(String albumName){ album = albumName; }

    //Set Length
    public void setLength(int trackLeng){ trackLength = trackLeng; }


    //**** Get Functions ****

    //Get Artist
    public String getArtist(){ return artist; }

    //Get Song
    public String getSong(){ return song; }

    //Get Album
    public String getAlbum(){ return album; }

    //Get Length
    public int getLength(){ return trackLength; }

    //To String
    public String toString(){

        if(getLength() &lt;= 0) {
            setLength(60);
        }

        return String.format("%s, %s, %s, %d : %d",
            getArtist(), getSong(), getAlbum(),
            getLength() / 60, getLength() - (getLength() / 60) * 60); //Converts Seconds to Min : Sec
    } 
}
</code></pre>

<p>The second part was being able to create a class named MP3Collection and add values to the arrayList. I haven't used ArrayList much before, which I feel is why this is becoming a pain. </p>

<pre><code>import java.util.ArrayList;

public class MP3Collection {

    //Instance Variables
    private int count = 0;
    ArrayList&lt;Object&gt; MP3List = new ArrayList&lt;Object&gt;();

    //Get Method
    public int getCount(){ return count; }

    //Set Method
    public void addMP3(String artist, String song, String album, int length) {
        MP3 newInfo = new MP3(artist, song, album, length);
    }

    public void outputInfo() {

        for (int i=0; i &lt; MP3List.size(); i++) {            
            String sonOutput = String.format("Song[%d]: %s: %s, %s, %d", count, artist, song, album, length);
        }
    }
}
</code></pre>

<p>As it's obvious, the outputInfo function is where my trouble is. I've tried using counter as a means of grabbing the info, however, since it is an Object ArrayList, it gives me an error.</p>

<p>I'm not sure what I'm supposed to do exactly in order to grab the correct data (song, artist, album, and length) from the ArrayList. Thank you.</p>