单选题:Given code below:
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
```
Set
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