(16)
Answer (Choose 1 answer)
A. The program will print out: 17
B. The program will print out: 19
C. The program has a compile error.
D. The program will print out: 21
What happens when you try to compile and run the following program?
import java.util.*;
public class Main {
public static void main(String argv[]){
Vector<Integer> t = new Vector<Integer>();
t.add(12);
t.add(2);
t.add(5);
t.add(2);
Iterator<Integer> i = t.iterator();
int sum=0;
while(i.hasNext()) sum += i.next();
System.out.println(sum);