Why am I receiving the following error: cannot find symbol: method add? This is my code:
import java.util.*
public class ArrayList {
// instance variables - replace the example below with your own
public void processinput(String s) {
int[] a = { 34, 25, 16, 98, 77, 101, 24 };
ArrayList b = new ArrayList();
for (int i = 0; i < a.length; i++) {
int d = a[i];
if (d % 2 > 0) {
b.add(new Integer(d));
}
}
for (int i = 0; i < b.size(); i++) {
System.out.print(b.get(i) + " ");
}
for (int i = a.length - 1; i >= 0; i--) {
System.out.print(a[i] + " ");
}
}
}
How can I resolve this error?
ArrayListsomewhere? If so you might accidentally using that instead ofjava.util.ArrayList, which you probably meant.