试题详情
- 单项选择题 import java.util.*; class KeyMaster { public int i; public KeyMaster(int i) { this.i = i; } public boolean equals(Object o) { return i == ((KeyMaster)o).i; } public int hashCode() { return i; } } public class MapIt { public static void main(String[] args) { Set
set = new HashSet (); KeyMaster k1 = new KeyMaster(1); KeyMaster k2 = new KeyMaster(2); set.add(k1); set.add(k1); set.add(k2); set.add(k2); System.out.print(set.size() + “:”); k2.i = 1; System.out.print(set.size() + “:”); set.remove(k1); System.out.print(set.size() + “:”); set.remove(k2); System.out.print(set.size()); } } What is the result?() A、 4:4:2:2
B、 4:4:3:2
C、 2:2:1:0
D、 2:2:0:0
E、 2:1:0:0
F、 2:2:1:1
G、 4:3:2:1
- F
关注下方微信公众号,在线模考后查看
热门试题
- 有如下一个类似跳表的数据结构:每层都是已
- What is th
- Given the&ensp
- 以下涉及到内存管理的代码段中,有错误的是
- public class&e
- What is th
- 为什么用面板来对组件进行排列?()
- 下面哪些类属于轻型组件()
- What will&ensp
- 选项中哪一行代码可以添加 题目
- 下面有关jsp中静态include和动态
- Given the
- The Squeaky&en
- public class&e
- import语句的作用是()
- 以下的Java程序代码中,错误的行是()
- 用sin(x)≈x-x^3/3!+x^5
- String[] eleme
- You want
- 1. import&ensp