title: The type of the expression must be an array type but it resolved to ArrayList (trying to compare string in two arrays
body: <p>Iam trying to compare each string or int in array with another array then print the results according to whether the string exists or not in the other array:
  Below is the whole code:
  I get error in the for loops when trying to comparing two values using .equals(not sure if its right method,,... I am new to this) Please help!</p>
  
  <pre><code>public class comparer {
  public void compare (){
  
      ArrayList NameofFileinDir = new ArrayList ();
      ArrayList Stocks = new ArrayList();
      // populate array with files names in dir
      try {   
          Scanner reads = new Scanner (new File("G:/Programming/StockDataDownload/NameOfFileinDir.txt"));
          String FileCode;
          while (reads.hasNext()){  
                 FileCode = reads.nextLine(); //read next line
                                 NameofFileinDir.add(FileCode);
  
          }
          reads.close();
          }
          catch (IOException e) { 
          }
      // populate array with original stocks
      try {   
          Scanner reads = new Scanner (new File("G:/Programming/StockDataDownload/AllSecurities.txt"));
          String StockCode;
          while (reads.hasNext()){  
                 StockCode = reads.nextLine(); //read next line
                 Stocks.add(StockCode);
  
          }
          reads.close();
           for(int i = 0; i &lt; Stocks.size(); i++) {
  
               for (int j = 0; j &lt; NameofFileinDir.size(); j++) {
                      if (Stocks[i].equals(NameofFileinDir[j])) &gt; 0) {
                          System.out.println("Stock:" + Stocks[i]);}
                      else{
                          System.out.println("Stock not in files:" + Stocks[i]);
                      }
                      }
               }
  
          }
          catch (IOException e) { 
          }
  
  }}
  </code></pre>