Problems with an ArrayList declaration.
Hello everyone, i have a problem with an ArrayList.
First of all, can an arrayList contain primitive kind of data such as int or char?
And why it gives this error " '(' or '[' expected " to the following line of code?
private ArrayList<int> numeriEstratti=new ArrayList<int>;
Re: Problems with an ArrayList declaration.
generic types can only be objects not primitives -- so change <int> to <Integer>. You'll also want to include ArrayList's parenthesis when you call its constructor:
private ArrayList<Integer> foo = new ArrayList<Integer>(); // don't forget the parenthesis!