1. import java.util.*;  2. public class Test {  3. public static void main(String[] args) {  4. List strings = new ArrayList();  5. // insert code here  6. }  7. }  Which four, inserted at line 5, will allow compilation to succeed?()A、 String s = strings.get(0);B、 Iterator i1 = strings.iterator();C、 String[] array1 = strings.toArray();D、 Iterator i2 = strings.iterator();E、 String[] array2 = strings.toArray(new String[1]);F、 Iterator i3 = strings.iterator();

1. import java.util.*;  2. public class Test {  3. public static void main(String[] args) {  4. List strings = new ArrayList();  5. // insert code here  6. }  7. }  Which four, inserted at line 5, will allow compilation to succeed?()

  • A、 String s = strings.get(0);
  • B、 Iterator i1 = strings.iterator();
  • C、 String[] array1 = strings.toArray();
  • D、 Iterator i2 = strings.iterator();
  • E、 String[] array2 = strings.toArray(new String[1]);
  • F、 Iterator i3 = strings.iterator();

相关考题:

在jsp页面中导入java.util包,使用下列哪个标记() A、%@import=”java.util.*”%B、%@import=”java.util.*”@%C、%@pageimport=”java.util.*”%D、%@pagejava=”java.util.*”%

设有如下程序: import java.util.*; public class Sun { public static void main(String args[ ]) { int score; String a; Random r=new Random(); score=r.nextInt(4)+5; switch(score) { case 0: a="E"; break; case 1: a="D"; break; case 2: a="C"; break; case 3: a="B"; break; default: a="A"; } System.out.println(A) ; } } 程序运行的结果是( )。A.a="A"B.aa"E" a="A"C.a="E"D.a="C"

2下列程序实现对ZIP 文件file.zip 的检索,在横线处填入正确的语句是( )。package test;import java.io.*;import java.util.*; import java.util.zip.*;public class Exam{ public static void main(String[] args){ try{ FileInputStream fis = new FilelnputStream("test/file.zip"); ZipInputStream zis = new ZiplnputStream(fis); ZipEntry en; while ((______ )!= null){ en.getName(); zis.closeEntry(); } zis.close(); } catch(Exception e){ e.pfintStackTrace(); }}A.en = zis. getNextEntry()B.en == zis.getNextEntry(C.en=zis. getEntry()D.zis.getNextEntry()

定义JavaApplet程序时,必须有import语句的是______。A.import java.awt.event;B.import java.lang.*;C.import java.applet.Applet;D.import java.util.*;

从对象流中读取对象,请在下面横线处填写代码完成此程序。import java.util. *;import java. io. *;public class UnSerializeDate{date d = null;UnSerializeDate ( ){try{FileInputStream f1 = new FileInputStream("date.ser");d = (Date) s. readobject ();f1,close();}catch (Exceptin e){e. printStackTrace ();}}public static main(String args [] ){System.out.println("The date read is: "+ a.d.toString());}}

下列程序实现对ZIP文件file.zip的检索,在横线处 填入正确的语句( )。 package test; importjava.io.*; import java.util.*; import java.util.zip.*; public class Exam { public static void main(String[]args){ try{ FileInputStream fis=new FileInputStream("test/file. zip"); ZipInputStream zis=new ZiplnputStream(fis); ZipEntry an; while(( )!=null){ en.getName; zis.closeEntry; } zis.close: } catch(Exception e){ printStackTrace; } } }A.en=zis.getNextEntryB.en= =zis.getNextEntryC.en=zis.getEntryD.zis.getNextEntry

下列程序实现对ZIP文件file.zip的检索,在横线处填入正确的语句 package test; import java.io.*: import java.util.*; import java.util.zip.*; public class Exam { public static void main(String[])args){ try{ FileInputStream fis=new FileInputStream("test/file.zip"); ZipInputStreamzis=new ZipInputStream(fis); ZipEntry en; while ((_____)!=null){ en.getName(); zis.closeEntry(); } zis.close(); } catch(Exception e) { e.printStackTrace(); } } }A.en = zis.getNextEntry()B.en = zis.getNextEntry()C.en = zis.getEntry()D.zis.getNextEntry()

当在JSP文件中要使用到Vector对象时,应在JSP文件中加入以下哪个语句?()A、〈jsp:include file=”java.util.*” /〉B、〈jsp:include page=”java.util.*” /〉C、〈%@ page import=”java.util.*” %〉D、〈%@ page include=”java.util.*” %〉

import java.util.*;  class Banana3 {  public static void main(String [] args) {  int x = 2;  Banana3 b = new Banana3();  b.go(x);  }  static { x += x; }  void go(int x) {  ++x;  System.out.println(x);  }  }  结果为:()  A、2B、3C、5D、编译失败

You are writing a JSP that includes scriptlet code to declare a List variable and initializes that variable to anArrayList object. Which two JSP code snippets can you use to import these list types?()A、%! import java.util.*; %B、%! import java.util.List;import java.util.ArrayList; %C、%@ page import=’java.util.List’import=’java.util.ArrayList’ %D、%@ import types=’java.util.List’types=’java.util.ArrayList’ %E、%@ page import=’java.util.List,java.util.ArrayList’ %F、%@ import types=’java.util.List,java.util.ArrayList’ %

import java.util.*;  public class PQ {  public static void main(String[] args) {  PriorityQueue pq = new PriorityQueue();  pq.add(”carrot”); pq.add(”apple”);  pq.add(”banana”);  System.out.println(pq.poll() +”:” + pq.peek()); }  }  What is the result?() A、 apple:appleB、 carrot:appleC、 apple:bananaD、 banana:appleE、 carrot:carrotF、 carrot:banana

与page指令%@ page import= “java.util.*, java.text.* “ % 等价的是()。A、%@ import="“java.util.*" page=""%@ import="“java.text.*" page=""%@ import="“java.text.*" page=""%@ import="“java.util.*" page=""%@ import="“java.text.*" page=""%@ import="“java.util.*" page=""%@ page import= “java.util.* % %@ page import= “java.text.* “ % B、%@ page import= “java.util.*”  ,  import= “java.text.* “ % C、%@ page import= “java.util.* “  ;  % %@ page import= “java.text.* “  ; %D、%@ page import= “java.util.* ; java.text.* “ %

定义Java.Applet程序时,必须有的import语句是()。A、import  java.awt.event;B、import  java.util. * ;C、import  java.applet.Applet;D、import  java.1ang.* ;

Given a class Repetition: 1.package utils; 2. 3.public class Repetition{ 4.public static String twice(Strings){returns+s;} 5.} and given another class Demo: 1.//insert code here2. 3.public class Demo{ 4.public static void main(String[]args){ 5.System.out.println(twice("pizza")); 6.} 7.} Which code should be inserted at line 1 of Demo.java to compile and run Demo to print“pizzapizza”?()A、import utils.*;B、static import utils.*;C、importutils.Repetition.*;D、static importutils.Repetition.*;E、import utils.Repetition.twice();F、import static utils.Repetition.twice;G、static import utils.Repetition.twice;

1. import java.util.*;  2. public class Example {  3. public static void main(String[] args) {  4. // insert code here  5. set.add(new integer(2));  6. set.add(new integer(l));  7. System.out.println(set);  8. }  9. }  Which code, inserted at line 4, guarantees that this program will output [1,2]? ()A、 Set set = new TreeSet();B、 Set set = new HashSet();C、 Set set = new SortedSet();D、 List set = new SortedList();E、 Set set = new LinkedHashSet();

1. import java.util.*;  2.  3. Class FindStuff {  4. public static void  main(String [] args) {  5. // insert code here  6. c.put("x", 123);  7. }  8. } 分别插入到第5行,哪三行允许代码编译?() A、Map c = new SortedMap();B、HashMap c = new HashMap();C、HashMap c = new Hashtable();D、SortedMap c = new TreeMap();

单选题定义Java.Applet程序时,必须有的import语句是()。Aimport  java.awt.event;Bimport  java.util. * ;Cimport  java.applet.Applet;Dimport  java.1ang.* ;

单选题import java.util.*;  public class PQ {  public static void main(String[] args) {  PriorityQueue pq = new PriorityQueue();  pq.add(”carrot”); pq.add(”apple”);  pq.add(”banana”);  System.out.println(pq.poll() +”:” + pq.peek()); }  }  What is the result?()A apple:appleB carrot:appleC apple:bananaD banana:appleE carrot:carrotF carrot:banana

多选题1. import java.util.*;  2. public class Test {  3. public static void main(String[] args) {  4. List strings = new ArrayList();  5. // insert code here  6. }  7. }  Which four, inserted at line 5, will allow compilation to succeed?()AString s = strings.get(0);BIterator i1 = strings.iterator();CString[] array1 = strings.toArray();DIterator i2 = strings.iterator();EString[] array2 = strings.toArray(new String[1]);FIterator i3 = strings.iterator();

单选题import java.util.*;  class ScanStuff {  public static void main(String [] args) {  String s = "x,yy,123";  Scanner sc = new Scanner(s);  while (sc.hasNext())  System.out.print(sc.next() + " ");  }  }  结果是什么?()Ax yyBx,yyCx yy 123Dx,yy,123

单选题与page指令 等价的是()。A%@ import="“java.util.*" page=""%@ import="“java.text.*" page=""%@ import="“java.text.*" page=""%@ import="“java.util.*" page=""%@ import="“java.text.*" page=""%@ import="“java.util.*" page=""%@ page import= “java.util.* % %@ page import= “java.text.* “ % B%@ page import= “java.util.*”  ,  import= “java.text.* “ % C%@ page import= “java.util.* “  ;  % %@ page import= “java.text.* “  ; %D%@ page import= “java.util.* ; java.text.* “ %

单选题1. import java.util.*;  2. class ForInTest {  3. static List list = new ArrayList();  4.  5. static List getList() { return list; }  6.  7. public static void main(String [] args) {  8. list.add("a"); list.add("b"); list.add("c");  9. // insert code here  10. System.out.print(o);  11. }  12. } 第 9 行插入哪一项将输出 abc?()Afor(char o: list)Bfor(Object o: getList())Cfor(Object o: getList();)Dfor(Object o: o.getList())

多选题现有:  1. import java.util.*;      2.  3. Class FindStuff  {  4.public static void main (String[]args)    {      5,    //insert code here      6.    c.put ("X", 123);      7.    }      8.  } 分别插入到第5行,哪三行允许代码编译?()AMap c= new SortedMap();BHashMap c= new HashMap();CHashMap c= new Hashtalole();DSortedMap c= new TreeMap();EArrayList c= new ArrayList();FMaD c = new LinkedHashMap();

单选题当在JSP文件中要使用到Vector对象时,应在JSP文件中加入以下哪个语句?()A〈jsp:include file=”java.util.*” /〉B〈jsp:include page=”java.util.*” /〉C〈%@ page import=”java.util.*” %〉D〈%@ page include=”java.util.*” %〉

多选题You are writing a JSP that includes scriptlet code to declare a List variable and initializes that variable to anArrayList object. Which two JSP code snippets can you use to import these list types?()A%! import java.util.*; %B%! import java.util.List;import java.util.ArrayList; %C%@ page import=’java.util.List’import=’java.util.ArrayList’ %D%@ import types=’java.util.List’types=’java.util.ArrayList’ %E%@ page import=’java.util.List,java.util.ArrayList’ %F%@ import types=’java.util.List,java.util.ArrayList’ %

单选题现有:  import java.util.*;      class AddStuff2  {  public static void main(String  []  args)  {      TreeSett=new TreeSet();      if (t.add("one"))      if (t.add("two"))     if (t.add ("three"))  add("four");  for (String s  :  t)      System.out.print (s);     }      }      结果为:()A oneB one three twoC one two threeD one two three fourE four one three twoF编译失败

单选题Given a class Repetition:  1. package utils;  2.  3. public class Repetition {  4. public static String twice(String s) { return s + s; }  5. }  and given another class Demo:  1. // insert code here 2.  3. public class Demo {  4. public static void main(String[] args) {  5. System.out.println(twice(”pizza”));  6. }  7. }  Which code should be inserted at line 1 of Demo.java to compile and run Demo to print“pizzapizza”?()A import utils.*;B static import utils.*;C import utils.Repetition.*;D static import utils.Repetition. *;E import utils.Repetition.twice();F import static utils.Repetition.twice;G static import utils.Repetition.twice;

单选题现有:  import java.util.*;      class  ScanStuff  {  public  static void main (String  []  args)  {     String S= "x,yy,123";  Scanner sc = new Scanner (s);      while  (sc.hasNext())  System.out.print (sc.next()  +" ");     }      }  结果是什么?()A  x yyB x,yy,123C  x yy 123D  x,yyE编译失败F运行的时候有异常抛出