-->
当前位置:首页 > 题库

单选题:Given code below:

Luz5年前 (2021-05-10)题库870
Given code below:
```
Set s = new HashSet();
s.add(new Integer(1));
s.add(new Integer(2));
s.add(new Integer(1));
```
Which statement below is correct? @[A](2)
A. It compiles, but only two elements left in `s`.
B. It does not compile.
C. It compiles but exception raises at line 4, for 1 is already in the set.
D. It complies and there are three elements in `s`.



A.It compiles, but only two elements left in `s`.
B.It does not compile.
C.It compiles but exception raises at line 4, for 1 is already in the set.
D.It complies and there are three elements in `s`.


答案:A