欢迎来到易学考试网 易学考试官网
全部科目 > Java认证考试 > SCJP程序员认证考试

单项选择题

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.

点击查看答案&解析

相关考题

微信小程序免费搜题
微信扫一扫,加关注免费搜题

微信扫一扫,加关注免费搜题