登录
扫码即可体验小程序
下列()接口不是继承于Collection接口。
下列能表示栈(stack)s1长度的是( )。
有关Set说法错误的是()。
有关List说法错误的是()
有关Map说法错误的是()。
下列说法不正确的是()
所有的集合类都包含在( )包中。
Java的集合框架中,最顶层的两个接口是( ) ①Collection ②Set ③List ④Map
Map接口提供了一种映射关系,元素是以键值对(key-value)的形式存储的,能根据key快速查找value;其中_______ 不能重复, ______可以重复。
以下说法错误的是()
Public class Test { Public static void main(String[] args) { Vector teamList = new Vector(); teamList.add("Z"); teamList.add("L"); teamList.add("W"); teamList.remove(0); teamList.remove(0); System.out.println(teamList.size()+","+teamList.get(0)); } } 程序运行的结果是 ( )。
public class SetTest { public static void main(String[] args) { HashSet hs = new HashSet(); boolean b1 = hs.add("a"); hs.add("b"); hs.add("c"); hs.add("d"); hs.add("d"); boolean b2 = hs.add("a"); System.out.println("size="+hs.size()); } } 程序运行的结果是 size= ( )。
public class StackTest { public static void main(String[] args) { Stackst = new Stack(); st.push(new Integer(11)); st.push(new Integer(22)); st.push(new Integer(33)); System.out.println("size is-> "+st.size()); System.out.println("Top is-> "+st.peek()); st.pop(); System.out.println("new Top is-> "+st.peek()); } } 程序运行的结果是 size= ( )。
public class MapTest { public static void main(String[] args) { HashMap<String, String> map = new HashMap<>(); map.put("zhao", "100"); map.put("qian", "85"); map.put("sun", "30"); map.put("li", "99"); System.out.println("size:"+map.size()); System.out.println("zhao:"+map.containsKey("zhao")); System.out.println("zhao:"+map.get("zhao")); } } 结果为: size:4 zhao:true zhao:100 程序运行的结果是 size= ( )。