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; i >= 0; i--) {
System.out.print(a[i] + " ");
}
}
}
Notice package班级:你的ArrayList
is not java.util.ArrayList
.
Correct:
java.util.ArrayList b = new java.util.ArrayList();
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)