I am trying to complete a JCF array list, and it compiled just fine 30 minutes ago, but now I am receiving the error "The type ArrayList is not generic; it cannot be parameterized with arguments ". I have tried a few things to figure it out, but I am at a loss. Here is the code:
import java.util.*;
/**
* Class to test the java.util.ArrayList class.
*/
public class Main
{
public static void main(String[] args)
{
Main myAppl = new Main();
}
public Main()
{
ArrayList<Integer> numbers = new ArrayList<Integer>();
//list creation
for (int i = 0; i < 10; i++)
numbers.add((int) (Math.random() * 100));
System.out.println("List of numbers:");
System.out.println(numbers);
Scanner in = new Scanner(System.in);
System.out.print("Please, enter an int value: ");
int x = in.nextInt();
if (numbers.contains(x))
System.out.println("Found!");
else
System.out.println("Not found!");
}
}
ArrayListclass in your classpath. Replaceimport java.util.*;withjava.util.ArrayList, and I'm sure it would certainly work.System.out.println(numbers.getClass());output?