网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)
单选题
Given: String[] elements = { "for", "tea", "too" }; String first = (elements.length > 0) ? elements[0] : null; What is the result?()
A

Compilation fails.

B

An exception is thrown at runtime.

C

The variable first is set to null.

D

The variable first is set to elements[0].


参考答案

参考解析
解析: 暂无解析
更多 “单选题Given: String[] elements = { "for", "tea", "too" }; String first = (elements.length  0) ? elements[0] : null; What is the result?()A Compilation fails.B An exception is thrown at runtime.C The variable first is set to null.D The variable first is set to elements[0].” 相关考题
考题 String[] elements={for,tea,too};String first=(elements.length0)?elements[0]null;What is the result?() A.Compilation fails.B.An exception is thrown at runtime.C.The variable first is set to null.D.The variable first is set to elements[0].

考题 String[]elements={for”,tea”,too”};Stringfirst=(elements.length0)?elements[0]null;Whatistheresult?() A.Compilationfails.B.Anexceptionisthrownatruntime.C.Thevariablefirstissettonull.D.Thevariablefirstissettoelements[0].

考题 Given:Which regular expression, inserted at line 12, correctly splits test into Test A, Test B, and Test C?() A.String regex=;B.String regex= .;C.String regex=.*;D.String regex=\\s;E.String regex=\\.\\s*;F.String regex=\\w[\.]+;

考题 Given:String[]elements={for,tea,too};Stringfirst=(elements.length0)?elements[0]:null;Whatistheresult?() A.Compilationfails.B.Anexceptionisthrownatruntime.C.Thevariablefirstissettonull.D.Thevariablefirstissettoelements[0].

考题 Given:Andthefollowingfivefragments:publicstaticvoidmain(String...a){publicstaticvoidmain(String.*a){publicstaticvoidmain(String...a){publicstaticvoidmain(String[]...a){publicstaticvoidmain(String...[]a){Howmanyofthecodefragments,insertedindependentlyatline2,compile?()A.0B.1C.2D.3E.4

考题 floatf;Strings;现需要把float转化为String,正确的语句是()A、s=String.valueOf(f);B、f=Float.parseFloat(s);C、s=f;D、s=(String)f;

考题 String[] elements = { “for”, “tea”, “too” };  String first = (elements.length  0)? elements[0] null;  What is the result?()A、 Compilation fails.B、 An exception is thrown at runtime.C、 The variable first is set to null.D、 The variable first is set to elements[0].

考题 Given: 11.String test = "a1b2c3"; 12.String[] tokens = test.split("//d"); 13.for(String s: tokens) System.out.print(s + " "); What is the result?()A、a b cB、1 2 3C、a1b2c3D、a1 b2 c3

考题 Given that c is a reference to a valid java.io.Console object, which two code fragments read a line of text from the console?()A、String s = c.readLine();B、char[ ] c = c.readLine();C、String s = c.readConsole();D、char[ ] c = c.readConsole();E、String s = c.readLine("%s", "name ");F、char[ ] c = c.readLine("%s", "name ");

考题 有声明语句:delegate void TimeDelegate(string s),则以下语句可以和委托TimeDelegate绑定的方法是()A、 void f(){  }B、 string f(){  }C、 void f(string a){  }D、 string f(string a){  }

考题 Given the following code:     1) class Parent {     2) private String name;     3) public Parent(){}     4) }  5) public class Child extends Parent {     6) private String department;  7) public Child() {}  8) public String getValue(){ return name; }     9) public static void main(String arg[]) {     10) Parent p = new Parent();     11) }  12) }  Which line will cause error?()   A、 line 3B、 line 6C、 line 7D、 line 8E、 line 10

考题 Given the JSP code: % request.setAttribute("foo", "bar"); %and the Classic tag handler code: 5. public int doStartTag() throws JspException { 6. // insert code here 7. // return int 8. } Assume there are no other "foo" attributes in the web application. Which invocation on the pageContextobject,inserted at line 6,assigns "bar" to the variable x?()A、String x = (String) pageContext.getAttribute("foo")B、String x = (String) pageContext.getRequestScope("foo")C、It is NOT possible to access the pageContext object from within doStartTagD、String x = (String) pageContext.getRequest().getAttribute("foo")E、String x = (String) pageContext.getAttribute("foo", PageContext.ANY_SCOPE)

考题 Given an EL function declared with:11.  12.spin 13.com.example.Spinner 14. 15.java.lang.String spinIt() 16. 17. Which two are true?()A、The function method must have the signature: public String spin().B、The method must be mapped to the logical name "spin" in the web.xml file.C、The function method must have the signature: public String spinIt().D、The function method must have the signature public static String spin().E、The function method must have the signature: public static String spinIt().F、The function class must be named Spinner, and must be in the package com.example.

考题 Which is the earliest line in the following code after which the object created on the line marked (0) will be a candidate for being garbage collected, assuming no compiler optimizations are done? ()  public class Q76a9 {   static String f() {   String a = "hello";   String b = "bye"; // (0)   String c = b + "!"; // (1)   String d = b;  b = a; // (2)   d = a; // (3)   return c; // (4)  }   public static void main(String args[]) {   String msg = f();   System.out.println(msg); // (5)   }   }  A、The line marked (1).B、The line marked (2).C、The line marked (3).D、The line marked (4).E、The line marked (5).

考题 11. String test = “Test A. Test B. Test C.”;  12. // insert code here  13. String[] result = test.split(regex);  Which regular expression inserted at line 12 will correctly split test into “Test A,” “Test B,” and “Test C”?()A、 String regex = “”;B、 String regex = “ “;C、 String regex = “.*“.D、 String regex = “//s”E、 String regex = “//.//s*”;F、 String regex = “//w[ /.] +“;

考题 Given: String[] elements = { "for", "tea", "too" }; String first = (elements.length  0) ? elements[0] : null; What is the result?()A、Compilation fails.B、An exception is thrown at runtime.C、The variable first is set to null.D、The variable first is set to elements[0].

考题 Given that c is a reference to a valid java.io.Console object,which two code fragments read a line of textfrom the console?()A、String s = c.readLine();B、char[] c = c.readLine();C、String s = c.readConsole();D、char[] c = c.readConsole();E、String s = c.readLine("%s", "name ");

考题 Given: 11.String test = "Test A. Test B. Test C."; 12.// insert code here 13.String[] result = test.split(regex); Which regular expression, inserted at line 12,correctly splits test into "Test A","Test B",and "Test C"?()A、String regex = "";B、String regex = " ";C、String regex = ".*";D、String regex = "//s";E、String regex = "//.//s*";

考题 单选题有声明语句:delegate void TimeDelegate(string s),则以下语句可以和委托TimeDelegate绑定的方法是()A  void f(){  }B  string f(){  }C  void f(string a){  }D  string f(string a){  }

考题 单选题以下是子过程或函数过程定义中的开始语句,错误的为()。A Private Function f( x As String ) As SingleB Private Function f( x As String )C Private Sub f( x As String ) As SingleD Private Sub f( x As String )

考题 单选题String[] elements={"for","tea","too"}; String first=(elements.length0)?elements[0]null; What is the result?()A Compilation fails.B An exception is thrown at runtime.C The variable first is set to null.D The variable first is set to elements[0].

考题 单选题Which is the earliest line in the following code after which the object created on the line marked (0) will be a candidate for being garbage collected, assuming no compiler optimizations are done? ()  public class Q76a9 {   static String f() {   String a = "hello";   String b = "bye"; // (0)   String c = b + "!"; // (1)   String d = b;  b = a; // (2)   d = a; // (3)   return c; // (4)  }   public static void main(String args[]) {   String msg = f();   System.out.println(msg); // (5)   }   }A The line marked (1).B The line marked (2).C The line marked (3).D The line marked (4).E The line marked (5).

考题 单选题Given: 11.String test = "This is a test"; 12.String[] tokens = test.split("/s"); 13.System.out.println(tokens.length); What is the result?()A 0B 1C 4D Compilation fails.

考题 单选题Given the uncompleted code of a class:     class Person {  String name, department;     int age;  public Person(String n){  name = n; }  public Person(String n, int a){  name = n;  age = a;  }  public Person(String n, String d, int a) {  // doing the same as two arguments version of constructor     // including assignment name=n,age=a    department = d;     }     }  Which expression can be added at the "doing the same as..." part of the constructor?()A  Person(n,a);B  this(Person(n,a));C  this(n,a);D  this(name,age);

考题 单选题11. String test = “Test A. Test B. Test C.”;  12. // insert code here  13. String[] result = test.split(regex);  Which regular expression inserted at line 12 will correctly split test into “Test A,” “Test B,” and “Test C”?()A  String regex = “”;B  String regex = “ “;C  String regex = “.*“.D  String regex = “//s”E  String regex = “//.//s*”;F  String regex = “//w[ /.] +“;

考题 单选题Given: Which regular expression, inserted at line 12, correctly splits test into "Test A", "Test B", and "Test C"?()A String regex="";B String regex=" .";C String regex=".*";D String regex="//s";E String regex="//.//s*";F String regex="//w[/.]+";

考题 单选题floatf;Strings;现需要把float转化为String,正确的语句是()A s=String.valueOf(f);B f=Float.parseFloat(s);C s=f;D s=(String)f;