title: Filling an array with objects
body: <p>I need some help with a homework question I am working on.
  I need to create a "Library" class that contains an array of Song objects.(capacity of 10).
  Then make a method addSong.
  Here's what I have so far:</p>
  
  <pre><code>public class Library{
  
      Song[] arr = new Song[10];
  
      public void addSong(Song s){
          for(int i=0; i&lt;10; i++)
              arr[i] = s;
      }
  }
  </code></pre>
  
  <p>My question is: Is there another way to fill the array? i will later need to search for a song based on a index value. So i will create a method like:
  public Song getSong(int idx)
  Thank you in anticipation for your answers!</p>