title: how to create multiple instances of a class?
body: <p>I have a class Borrower which consists of a name and then it also stores an arraylist full of items that the person has borrowed.</p>
  
  <p>I want to be able to create multiple instances of this class from my main and then be able to access them to view the items they have borrowed.</p>
  
  <p>I am having trouble understanding how to create multiple instances. I just keep running into the issue of overwriting the the Borrowed class.</p>
  
  <p>So in the code below if I create newBorrower("Tim") and then addItem("Wrench"), and then go to create newBorrower("john") then I overwrite newBorrower.</p>
  
  <p>I want to be able to create multiple instances of Borrower based on user input?</p>
  
  <p>I've tried saving the entire Borrower class. I'm not sure if that would work, because it will not sort so I can't add multiple names or I get an error.</p>
  
  <p>Borrower Class</p>
  
  <pre><code>public class Borrower 
  {
  
      protected String name;
      protected String item;
  
      ArrayList&lt;String&gt; itemList = new ArrayList&lt;String&gt;();
  
      public Borrower()
      { 
      }
  
      public Borrower(String name)
      {
          this.name = name;
      }
  
      public String getName()
      {
          return name;
      }
  
      public void addItem(String item)
      {
          this.item = item;
          itemList.add(item);
      }
  </code></pre>
  
  <p>Main Class</p>
  
  <pre><code>public class WhoBorrowedIt 
  {
  
      public static void main(String[] args) 
      {
          ArraySortedList&lt;String&gt; borrowersList = new ArraySortedList&lt;String&gt;();
          Borrower newBorrower = new Borrower();
          Borrower otherBorrower = new Borrower();
  
          Scanner inName = new Scanner(System.in);
          Scanner inItem = new Scanner(System.in);
  
          String item;
          String name;
  
          String menu;
          int option;
  
          menu = "Make a selection: " + "\n" 
                  + "1. Add Borrower" + "\n"
                  + "2. Add Item Borrowed" + "\n"
                  + "3. Remove Item Returned" + "\n"
                  + "4. View Borrowers" + "\n"
                  + "5. Exit";
  
          do
          {
              Scanner in = new Scanner(System.in);
              System.out.println(menu);
              option = in.nextInt();
  
              switch(option)
              {
                  case 1: //create borrower
                  {
                      System.out.println("Enter Name");
                      name = inName.nextLine();
                      newBorrower = new Borrower(name);
                      borrowersList.add(newBorrower.getName());
                      break;
                  }
  
                  case 2: //add items
                  {
                      System.out.println("Enter item");
                      item = inItem.nextLine();
                      System.out.println("Who is borrowing");
                      name = inName.nextLine();
                      if(borrowersList.contains(name))
                      {
                          newBorrower.addItem(item);
                      }
                      else
                      {
                          newBorrower = new Borrower(name);
                          borrowersList.add(newBorrower.getName());
                          newBorrower.addItem(item);
                      }
                  }
          }while(option != 5)
  }
  }
  </code></pre>