title: Don't know how to add string to arraylist and make it stick
body: <p>I'm new to java and I was trying to test what I've learned by creating a TestAddRemove program. Essentially it's supposed to make you choose one of two arrays and allows you to add a company name, remove a company name and read whether a company you're looking for is in one of the arrays. </p>
  
  <p>My main problem is with the adding to the arrays part. Each time I add a company using the Add class it works, but then when I check the arrays again the arrays are empty.</p>
  
  <p><strong>Main Questio</strong>n: How do I add a companyName to an array in the main program and have it stick?</p>
  
  <p>Here's my code:</p>
  
  <pre><code>public class TestAddRemove 
  {
      static Scanner sc = new Scanner(System.in);
      static ArrayList&lt;String&gt; fileOne = new ArrayList&lt;String&gt;();
      static ArrayList&lt;String&gt; fileTwo = new ArrayList&lt;String&gt;(); 
      :
      :  //Some other stuff
      :
      String tryAgain = "Y";
      String answer;
      String fileAnswer;
  
      System.out.println("Welcome to the company tester; this program tests whether the company"
              + "you input is a company we already received donations from or a company we have"
              + "spoken to already, but declined to donate."); 
  
      while (tryAgain.equalsIgnoreCase("Y"))
      {
          System.out.println("Do you want to test, add or remove a company name? ");
          answer = sc.next();
          String companyName;
  
  
          if (answer.equalsIgnoreCase("add"))
          {
              System.out.println("Which file do you want to add to?");
              fileAnswer = sc.next();
  
              if (fileAnswer.equalsIgnoreCase("fileOne"))
              {
                  Add file = new Add(fileOne);
                  System.out.println("Enter the company name you want to add. ");
                  companyName = sc.next();
  
                  file.addCompany(companyName);
              }
              else
              {
                  Add file = new Add(fileTwo);
                  System.out.println("Enter the company name you want to add. ");
                  companyName = sc.next();
  
                  file.addCompany(companyName);
              }
  </code></pre>
  
  <p>The rest of the code is for the remove and test methods which I think I could understand once I understand how to add the companyName.</p>
  
  <p>Here's the Add Class:</p>
  
  <pre><code>public class Add 
  {
      Scanner sc = new Scanner(System.in);
      ArrayList&lt;String&gt; file;
  
      public Add(ArrayList&lt;String&gt; fileOne)
      {
          this.file = fileOne;
      }
  
      public void addCompany (String companyName)
      {
  
          file.add(companyName);
      }
  
      public ArrayList&lt;String&gt; getFile()
      {
          return file;
      }
  
  }
  </code></pre>
  
  <p>Any help on this would be awesome, thanks and cheers!</p>