PRO192_-_SP_2024_-_Block_5_-_RE_1965.webp
T

PRO192_-_SP_2024_-_Block_5_-_RE_1965.webp

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

  • Like
Reactions: Keiz and KOROKORO

Thông tin

Category
PRO192
Thêm bởi
thanhhoa88
Ngày thêm
Lượt xem
6,443
Lượt bình luận
29
Rating
0.00 star(s) 0 đánh giá

Image metadata

Filename
PRO192_-_SP_2024_-_Block_5_-_RE_1965.webp
File size
212.9 KB
Dimensions
1920px x 1012px

Share this media

Back
Bên trên Bottom