试题详情
单项选择题 import java.util.*;  public class WrappedString {  private String s;  public WrappedString(String s) { this.s = s; }  public static void main(String[] args) {  HashSet hs = new HashSet();  WrappedString ws1 = new WrappedString(”aardvark”);  WrappedString ws2 = new WrappedString(”aardvark”);  String s1 = new String(”aardvark”);  String s2 = new String(”aardvark”);  hs.add(ws1); hs.add(ws2); hs.add(s1); hs.add(s2);  System.out.println(hs.size()); } }  What is the result?() 

A、 0

B、 1

C、 2

D、 3

E、 4

F、 Compilation fails.

G、 An exception is thrown at runtime.

  • D
  • 关注下方微信公众号,在线模考后查看

热门试题