title: How to write an If statement with ArrayList
body: <p>I have an assignment that I am working on for school and we had to create an ArrayList that takes in two parameters and stores them. Then I had to write an "if" statement and if there are no Movies then print a line but if there are movies then loop it and print every movies info. Well I'm having a hard time writing the if statement. </p>
  
  <pre><code>import java.util.ArrayList;
  
  public class MovieLibrary
  {
  private ArrayList&lt;Movie&gt; movies;
  public String movieTitle;
  public int movieRunLength;
  
  public MovieLibrary()
  {
      movies = new ArrayList&lt;Movie&gt;();
  }
  
  public void addMovie(String title, int runLength)
  {
      movies.add(new Movie(title, runLength));
  }
  
  public void printMovies()
  {
      System.out.println("#################");
      if (movies == null){
           System.out.println("No movies in the library");
          }
      else{
          for (Movie movie : movies){
              movie.printMovieInfo();
          }
      }               
      System.out.println("#################");        
  }
  }
  </code></pre>
  
  <p>The code compiles and runs and the loop works (if there is information) but the message does not print if there isn't anything in the list. </p>