多选题ArraryList a = new ArrayList(); a.add(“Alpha”); a.add(“Bravo”): a.add(“Charlie”); a.add(“Delta”); Iterator iter = a.iterator(); Which two, added at line 17, print the names in the ArrayList in alphabetical order?()Afor (int i=0; i a.size(); i++) System.out.println(a.get(i)));Bfor (int i=0; i a.size(); i++) System.out.println(a[i]);Cwhile( iter.hasNext() ) System.out.println(iter.next()) ;Dfor (int i=0, i a.size(); i++) System.out.println(iter[i]);Efor (int i=0; i a.size(); i++) System.out.println(iter.get(i));
多选题
ArraryList a = new ArrayList(); a.add(“Alpha”); a.add(“Bravo”): a.add(“Charlie”); a.add(“Delta”); Iterator iter = a.iterator(); Which two, added at line 17, print the names in the ArrayList in alphabetical order?()
A
for (int i=0; i< a.size(); i++) System.out.println(a.get(i)));
B
for (int i=0; i< a.size(); i++) System.out.println(a[i]);
C
while( iter.hasNext() ) System.out.println(iter.next()) ;
D
for (int i=0, i< a.size(); i++) System.out.println(iter[i]);
E
for (int i=0; i< a.size(); i++) System.out.println(iter.get(i));
参考解析
解析:
暂无解析
相关考题:
欲构造ArrayList类的一个实例,此类继承了List接口,下列哪个方法是正确的?( B ) A.ArrayList myList=new Object();B.List myList=new ArrayList();C.ArrayList myList=new List();D.List myList=new List();
A lawyer’s income is usually very high, ________ more than one million yuan a year. A.add up toB.added up toC.amounted toD.amounting to
H.248协议中8个命令是()。 A.ADD、MODIFY、SUBTRACT、MOVEB.AUDITVALUE,AUDITCAPABILITYC.NOTIFY,SERICECHANGED.DELETE,DISPLAY
欲构造ArrayList类的一个实例,此类实现List接口,下列方法正确的是______。A.ArrayList myList=new Object( );B.List myList=new ArrayList( );C.ArrayList myList=new List( );D.List myList=new List( );
欲构造ArrayList类的一个实例,此类继承了List接口,下列( )方法是正确的。A.ArrayList myList=new Object();B.List myList=new ArrayList();C.ArrayList myList=new List();D.List myList=new List();
LTE中,用于添加下行虚拟负载的MML命令是()A.ADD CELLSINULOADB.ADD CELLOPC.ADD CELLRESELGERAND.ADD CELLEXTENDEDQCI
ArraryLista=newArrayList();a.add(Alpha”);a.add(Bravo”):a.add(Charlie”);a.add(Delta”);Iteratoriter=a.iterator();Whichtwo,addedatline17,printthenamesintheArrayListinalphabeticalorder?() A.for(inti=0;ia.size();i++) System.out.println(a.get(i)));B.for(inti=0;ia.size();i++) System.out.println(a[i]);C.while(iter.hasNext()) System.out.println(iter.next());D.for(inti=0,ia.size();i++) System.out.println(iter[i]);E.for(inti=0;ia.size();i++) System.out.println(iter.get(i));
函数模板:templateT add(T x, T y) {return x+y;}下列对add函数的调用不正确的是A.add 函数模板:template<class T> T add(T x, T y) {return x+y;} 下列对add函数的调用不正确的是A.add<>(1,2)B.add<int>(1,2)C.add(1.0,2)D.add(1.0,2.0)
下列程序采用BorderLayout布局管理,选择正确的语句填入横线处,实现在North区域显示一个名字为“北方”的Button构件。 import java.awt.*; public class ex48 { public static void main(String[] args) { frame. frm = new Frame. ("北方"); frm.setLayout(new BorderLayout()); frm.setSize(200, 200); frm.setVisible(true); } }A.add("Nouth", new Button("北方"));B.frm.add("South", new Button("北方"));C.frm.add("Nouth", new Button("北方"));D.Frm.add("South", Button("北方"));
若要在基本表S中增加一列CN(课程名),可用( )。 A.ADD TABLE S(CN CHAR(8)) B.ADD TABLE S A 若要在基本表S中增加一列CN(课程名),可用( )。A.ADD TABLE S(CN CHAR(8))B.ADD TABLE S ALTER(CN CHAR(8))C.ALTER TABLE S ADD(CN CHAR(8))D.ALTER TABLE S (ADD CN CHAR(8))
通常我们使用( )方法来为一个部件注册事件监听器。A.add×××ListenerB.×××ListenerSX 通常我们使用( )方法来为一个部件注册事件监听器。A.add×××ListenerB.×××ListenerC.Listener×××D.×××Listeneradd
WhichutilityallowsatechniciantoseethestatusofsystemresourcessuchasIRQsonaWindows2000computer?() A.Add/RemoveHardwareB.WINNT32C.SYSEDITD.DeviceManager
欲构造ArrayList类的一个实例,此类继承了List接口,下列( )是正确的。A.ArrayListmyList=new Object();B.List myList=new ArrayList();C.ArrayList myList=new List();D.List myList=new List();
本题是一个Applet,它显示了一个树型结构。单击树结点的时候,就能将其子结点展开,同时下面的文本框可以显示出所单击的结点的路径,比如单击了根结点下B结点下B2结点,则文本框显示为"[TOP,B,B2]"。import java.awt.*;import java.awt.event.*;import javax.swing.*;import javax.swing.tree.*;public class java2 extends JApplet{JTree tree;JTextField jtf;public void init(){Container cp=getContentPane();cp.setLayout(new BorderLayout());top=new DefaultMutableTreeNode("TOP"):DefaultMutableTreeNode a=new Default-MutableTreeNode("A");DefaultMutableTreeNode al = new Default-MutableTreeNode("Al");a.add(a1);DefatIltMutableTreeNode a2=new Default-MutableTreeNode("A2");a.add(a2);DefaultMutableTreeNode a3=new Default-MutableTreeNode("A3");a.add(a3);DefaultMutableTreeNode b=new Default-MutableTreeNode("B");DefaultMutableTreeNode bl=new Default-MutableTreeNode("Bl");b.add(b1);DefaultMutableTreeNode b2=new Default-MutableTreeNode("B2");b.add(b2);DefaultMutableTreeNode b3=new Default-MutableTreeNode("B3"):b.add(b3);top.add(a);top.add(b);tree=new JTree(top);int v=ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED;int h=ScrollPaneConstants.HORIZONTAL_SCRoLLBAR_AS_NEEDED;JScrollPane jsp=new JScrollPane(tree,V,h);cp.add(jsp,BorderLayout.CENTER);jtf=new JTextField(20);cp.add(jtf,BorderLayout.SOUTH);tree.addMouseListener(new MouseAdapter(){public void mouseClicked(MouseEvent me){doMouseClicked(me);}});}void doMouseClicked(MouseEvent me){tp=tree.getPathForLocation(me.getX(),me.getY());if(tp!=null)jtf.setText(tp.toString());elsejtf.setText("");}}
ArraryList a = new ArrayList(); a.add(“Alpha”); a.add(“Bravo”): a.add(“Charlie”); a.add(“Delta”); Iterator iter = a.iterator(); Which two, added at line 17, print the names in the ArrayList in alphabetical order?()A、 for (int i=0; i a.size(); i++) System.out.println(a.get(i)));B、 for (int i=0; i a.size(); i++) System.out.println(a[i]);C、 while( iter.hasNext() ) System.out.println(iter.next()) ;D、 for (int i=0, i a.size(); i++) System.out.println(iter[i]);E、 for (int i=0; i a.size(); i++) System.out.println(iter.get(i));
创建一个ArrayList集合实例,该集合中只能存放String类型数据,下列()代码是正确的A、ArrayList myList=new ArrayList()B、ArrayListStringmyList=new ArrayList;()C、ArrayListmyList=new ArrayListString()D、ArrayListmyList=new List()
欲构造ArrayList类的一个实例,此类继承了List接口,下列哪个方法是正确的?()A、 ArrayList myList=new Object();B、 List myList=new ArrayList();C、 ArrayList myList=new List();D、 List myList=new List();
单选题创建一个ArrayList集合实例,该集合中只能存放String类型数据,下列()代码是正确的AArrayList myList=new ArrayList()BArrayListStringmyList=new ArrayList;()CArrayListmyList=new ArrayListString()DArrayListmyList=new List()
单选题1. import java.util.*; 2. class SubGen { 3. public static void main(String [] args) { 4. //insert code here 5. } 6. } class Alpha { } class Beta extends Alpha { } class Gamma extends Beta { } 和四段代码片段: s1. ArrayList〈? extends Alpha〉 list1 = new ArrayList〈Gamma〉(); s2. ArrayList〈Alpha〉 list2 = new ArrayList〈? extends Alpha〉(); s3. ArrayList〈? extends Alpha〉 list3 = new ArrayList〈? extends Beta〉(); s4. ArrayList〈? extends Beta〉 list4 = new ArrayList〈Gamma〉(); ArrayList〈? extends Alpha〉 list5 = list4; 哪些片段分别插入到第4行,可允许代码编译?()A只有s1B只有s3C只有s1和s3D只有s1和s4
多选题ArraryList a = new ArrayList(); a.add(“Alpha”); a.add(“Bravo”): a.add(“Charlie”); a.add(“Delta”); Iterator iter = a.iterator(); Which two, added at line 17, print the names in the ArrayList in alphabetical order?()Afor (int i=0; i a.size(); i++) System.out.println(a.get(i)));Bfor (int i=0; i a.size(); i++) System.out.println(a[i]);Cwhile( iter.hasNext() ) System.out.println(iter.next()) ;Dfor (int i=0, i a.size(); i++) System.out.println(iter[i]);Efor (int i=0; i a.size(); i++) System.out.println(iter.get(i));
单选题欲构造ArrayList类的一个实例,此类继承了List接口,下列哪个方法是正确的?()AArrayList myList=new Object();BList myList=new ArrayList();CArrayList myList=new List();DList myList=new List();