给定如下Java代码,可以填入横线处的代码是() A: Listlist=newArrayList(); B: Listlist=newList(); C: ArrayListlist=newArrayList(); D: LinkedListlist=newLinkedList();
给定如下Java代码,可以填入横线处的代码是() A: Listlist=newArrayList(); B: Listlist=newList(); C: ArrayListlist=newArrayList(); D: LinkedListlist=newLinkedList();
给定一段JAVA代码如下:要打印出list中存储的内容,以下语句正确的是( )。ArrayListlist = new ArrayList( ) ;list.add(“a”);list.add(“b”) ;Iterator it = list.iterator( ) ;
给定一段JAVA代码如下:要打印出list中存储的内容,以下语句正确的是( )。ArrayListlist = new ArrayList( ) ;list.add(“a”);list.add(“b”) ;Iterator it = list.iterator( ) ;
假设ArrayListlist包含{“red”,“red”,“green”}。以下代码执行后的list是什么?Stringelement="red";for(inti=0;i<list.size();i++)if(list.get(i).equals(element))list.remove(element); A: {"red","red","green"} B: {"red","green"} C: {"green"} D: {}
假设ArrayListlist包含{“red”,“red”,“green”}。以下代码执行后的list是什么?Stringelement="red";for(inti=0;i<list.size();i++)if(list.get(i).equals(element))list.remove(element); A: {"red","red","green"} B: {"red","green"} C: {"green"} D: {}
阅读下列程序publicclassExample{publicstaticvoidmain(String[]args){ArrayListlist=newArrayList();//创建ArrayList集合list.add("Tom");//向该集合中添加字符串list.add("Jerry");list.add("Donald");ListIteratorit=list.listIterator();while(it.hasNext()){Objectobject=it.next();if("Jerry".equals(object)){it.set("Speike");}}System.out.println(list);}}程序的运行结果是()
阅读下列程序publicclassExample{publicstaticvoidmain(String[]args){ArrayListlist=newArrayList();//创建ArrayList集合list.add("Tom");//向该集合中添加字符串list.add("Jerry");list.add("Donald");ListIteratorit=list.listIterator();while(it.hasNext()){Objectobject=it.next();if("Jerry".equals(object)){it.set("Speike");}}System.out.println(list);}}程序的运行结果是()