cannot find symbol-method add (java.lang.integer)..whats the problem actually? -
public class arraylist { // instance variables - replace example below own public void processinput (string s) { int[] = {34, 25, 16, 98, 77, 101, 24}; arraylist b = new arraylist(); for(int = 0; < a.length; i++) { int d = a[i]; if(d%2 > 0) { b.add(new integer(d)); } } for(int = 0; < b.size(); i++) { system.out.print(b.get(i) + " "); } for(int = a.length; >= 0; i--) { system.out.print(a[i] + " "); } } }
notice package of class: arraylist
not java.util.arraylist
.
correct:
java.util.arraylist b = new java.util.arraylist();
Comments
Post a Comment