title: NullPointer on Clip after Clip was initialized in for loop
body: <p>I have some code here and it's confusing me; I'm trying to figure out why I'm getting a null pointer exception. I set up a for-each-loop to initialize each clip. If I initialize each one by itself, it works just fine, and the clips play. </p>
  
  <pre><code>  musicArr[0]=menuMusic;
    soundArr[0]=shotSound;
    try
    {
       for(Clip c:musicArr)c=AudioSystem.getClip();
       for(Clip c:soundArr)c=AudioSystem.getClip();
       menuMusic.open(AudioSystem.getAudioInputStream(new File("menuMusic.wav")));
       shotSound.open(AudioSystem.getAudioInputStream(new File("shot.wav")));
    }catch(LineUnavailableException|UnsupportedAudioFileException|IOException ex){ex.printStackTrace();}
  </code></pre>
  
  <p>This is going to pose as a nuisance later when I add more sound clips and music clips to the program. Anyone know of a cause for this?</p>