title: What is the best way to add an instantiated objects to an ArrayList
body: <p>In this example, I created an ArrayList&lt;> of dogs instead of the usual Array[]. But, I want to know the best way to add the dog object to the ArrayList, and I also want to know the following: </p>
  
  <p>1- How is ArrayList differ from Array? Which one is better?</p>
  
  <p>2- Is it possible to use for loop to add the instantiated objects into the ArrayList?</p>
  
  <pre><code>import java.util.ArrayList;
  import java.util.Collections;
  
  public class DogDriver {
  
      public static void main(String[] args) {
          ArrayList&lt;Dog&gt; dogs = new ArrayList();
  
          Dog dog1 = new Dog("Alex", "American Pit Bull Terrier", 100); //(name, breed, license)
          Dog dog2 = new Dog("Duke", "German Shepherd", 113);
          Dog dog3 = new Dog("Lucy", "Rottweiler", 120);
          Dog dog4 = new Dog("Bailey", "Doberman Pinscher", 119);
  
          Collections.sort(dogs);
  
          for (Dog dog : dogs) {
              System.out.println(dog);
          }
      }
  }
  </code></pre>