title: Java null constructor
body: <p>So I have two classes  called songs and albums, here they are:</p>
  
  <pre><code>    public class Songs {
      private String title;
      private Double duration;
  
      public Songs(String title, Double duration) {
          this.title = title;
          this.duration = duration;
      }
  
      public Songs(){}
  
  
      public String getTitle() {
          return title;
      }
  
  
  
      public Double getDuration() {
          return duration;
      }
  
  
      public static Songs addSong(String title, Double duration){
          return new Songs(title,duration);
  
      }
  }
  
  
  
      import java.util.ArrayList;
  import java.util.LinkedList;
  
  public class Albums {
      private ArrayList&lt;Songs&gt; albums;
      private String name;
      private String title;
  
      public Albums(String name, String title) {
          this.albums = new ArrayList&lt;&gt;();
          this.name = name;
          this.title = title;
      }
  
      public boolean addSong(Songs songs){
          if(findSong(songs.getTitle())==null){
              this.albums.add(songs);
              return true;
          }else{
              System.out.println("Song alredy exist!");
              return false;
          }
  
      }
  
        private Songs findSong(String songName){
          for(int i=0;i&lt;this.albums.size();i++){
              Songs currentSong = this.albums.get(i);
              if(currentSong.equals(songName)){
                  return currentSong;
              }
          }
          return null;
      }
  }
  </code></pre>
  
  <p>The problem is the main, maybe my logic is not right, if I'm missing something please tell me:</p>
  
  <pre><code> public class Main {
  
      public static void main(String[] args) {
          Albums albums = new Albums("Alexandru", "Doi dsadcopii");
          Songs songs = new Songs("Patrascu",4.44);
          songs.addSong("Dorin",11.11);
          albums.addSong(songs);
  
          songs.addSong("Dorin",11.11);
          albums.addSong(songs);
  
  
          songs.addSong("Dorinsads",11.11);
          albums.addSong(songs);
  
  
          songs.addSong("Dorisadsan",11.11);
          albums.addSong(songs);
  
  
  
          System.out.println(songs.getTitle());
  
          albums.addSong(songs);
  
          albums.printSongs();
      }
  }
  </code></pre>
  
  <p>Why I'm getting the same value ? why those values from the .addSong where not added in the list ? This is my code to print the list:</p>
  
  <pre><code>    public void  printSongs() {
      for (int i = 0; i &lt; this.albums.size(); i++) {
          System.out.println(i + 1 + "--&gt;" + this.albums.get(i).getTitle() + "---&gt;" + this.albums.get(i).getDuration());
      }
  
  }
  </code></pre>
  
  <p>For sure I'm missing something but I dont know exactly where, any ideas how to fix this ? Thanks! :D
  The problem is when I'm using the .printSongs() method it prints the first value</p>