import java.util.ArrayList;
import java.util.Iterator;
public class Quizful {
protected static ArrayList<Integer> wallet;
public Quizful() {
wallet = new ArrayList<Integer>();
}
public static int money() {
int aSum = 0;
Iterator<Integer> iterator = wallet.iterator(); // --1--
while (iterator.hasNext())
aSum += iterator.next();
return aSum;
}
public static int money2() {
int aSum = 0;
for (Integer I : wallet) // --2--
aSum += I.intValue();
return aSum;
}
public static void main(String[] args)
{
wallet.add(new Integer(5)); // --3--
System.out.println(money() + money2());
}
}
Login in to like
Login in to comment