title: Abstract Class and Its Subclass
body: <p>I have the following codes which I found on the internet, this might be a simple question but your explanations will help me a lot. </p>
  
  <p>This is the abstract class named SongComponent</p>
  
  <pre><code>public abstract class SongComponent {
  
      public void add(SongComponent newSongComponent){
  
          throw new UnsupportedOperationException();
  
      }
      public void remove(SongComponent newSongComponent){
  
          throw new UnsupportedOperationException();
  
      }
  
      public SongComponent getComponent(int componentIndex){
  
          throw new UnsupportedOperationException();
  
      }
  
      public String getSongName(){
  
          throw new UnsupportedOperationException();
  
      }
  
      public String getBandName(){
  
          throw new UnsupportedOperationException();
  
      }
  
      public int getReleaseYear(){
  
          throw new UnsupportedOperationException();
  
      }
  
      public void displaySongInfo(){
  
          throw new UnsupportedOperationException();
  
      }
  
  
  
  
  }
  </code></pre>
  
  <p>This is the class that extends the abstract class named SongGroup </p>
  
  <pre><code>import java.util.ArrayList;
  import java.util.Iterator;
  public class SongGroup extends SongComponent {
  
      ArrayList songComponents = new ArrayList();
  
      String groupName;
      String groupDescription;
  
      public SongGroup(String newGroupName, String newGroupDesc){
  
          groupName = newGroupName;
          groupDescription = newGroupDesc;
  
  
      }
  
      public String getGroupName(){
          return groupName;
      }
  
      public String getGroupDescription(){
          return groupDescription;
      }
  
      // It overrides the add() method from its superclass 
      public void add(SongComponent newSongComp){
          songComponents.add(newSongComp);
      }
  
      public void remove(SongComponent newSongComp){
          songComponents.remove(newSongComp);
      }
  
      public SongComponent getComponent(int compIndex){
          return (SongComponent)songComponents.get(compIndex);
      }
  
      public void displaySongInfo(){
  
          System.out.println( getGroupName() + " " + 
          getGroupDescription());
  
          Iterator songIterator = songComponents.iterator();
  
          while(songIterator.hasNext()){
              SongComponent songInfo = (SongComponent)songIterator.next();
              songInfo.displaySongInfo();
          }
      }
  
  
  }
  </code></pre>
  
  <p>My question is, in what situation, the method of add() and other methods which have been overridden of the abstract class will be called? For example, when the method add() of the abstract class that results in throwing new UnsupportedOperationException will be called?  </p>