ArrayList warning- warning: [unchecked] unchecked call to add(E), also file will not run. Please help?
<p>I've been trying to get this code to work for what feels like an age at this stage. it is meant to compute prime numbers in a range, and I've written a method to print them. Unfortunately the code will not compile, citing the warning : </p>

<p>"warning: [unchecked] unchecked call to add(E) as a member of the raw type java.util.List"    </p>

<p>--I understand from googling that this warning is for not declaring what types of values should be in your erray, but I have done this, and the error only seems to come about when I try to use the .add() function on my array list.</p>

<p>and when I try to run it it gives a somewhat more scary error of 
"Static Error: Undefined name 'PrimeNumbers'</p>

<p>I think I've gone code-blind at this point and despite several attempts cannot find out what I am doing wrong. Would anyone be able to shed some light please ? Thanks a lot.</p>

<pre><code>import java.util.*;

public class PrimeNumbers { 

    private List listOfPrimeNumbers;  //add a member variable for the ArrayList
    public static void main(String args []){    
      PrimeNumbers primeNumberList = new PrimeNumbers(50);
      primeNumberList.print();  //use our new print method
    }

public PrimeNumbers (int initialCapacity) {
    listOfPrimeNumbers = new ArrayList&lt;Integer&gt;(initialCapacity/2);  //initialCapacity/2 is an easy (if not tight) upper bound
    long numberOfPrimes = 0; //Initialises variable numberOfPrimes to 0
    int start = 2;
    boolean[] isPrimeNumber = new boolean[initialCapacity + 1];

    for (int i=0;i==initialCapacity;i++) {//setting all values in array of booleans to true
    isPrimeNumber[i] = true;
    }
     while (start != initialCapacity)
        {
          if (isPrimeNumber[start])
          {
            listOfPrimeNumbers.add(start);
            //add to array list
            numberOfPrimes++;
            for (int i = start; start &lt; initialCapacity; i+=start)
            {
              isPrimeNumber[i] = false;
            }
          }
          start++;
        }
    }

 public void print()  //add this printout function
 {
     int i = 1; 
     Iterator iterator = listOfPrimeNumbers.listIterator();
     while (iterator.hasNext())
     {
          System.out.println("the " + i + "th prime is: " + iterator.next());
          i++;
     }
     //or just System.out.println(listOfPrimeNumbers);, letting ArrayList's toString do the work.  i think it will be in [a,b,c,..,z] format
 }

 public List getPrimes() {return listOfPrimeNumbers;} //a simple getter isnt a bad idea either, even though we arent using it yet
}
</code></pre>
