String[] elements =&e

题目

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].
如果没有搜索结果或未解决您的问题,请直接 联系老师 获取答案。
相似问题和答案

第1题:

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[\.]+";


参考答案:E

第2题:

Given:Andthefollowingfivefragments:publicstaticvoidmain(String...a){publicstaticvoidmain(String.*a){publicstaticvoidmain(String...a){publicstaticvoidmain(String[]...a){publicstaticvoidmain(String...[]a){Howmanyofthecodefragments,insertedindependentlyatline2,compile?()

A.0

B.1

C.2

D.3

E.4


参考答案:D

第3题:

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].


参考答案:D

第4题:

Which expressions will evaluate to true if preceded by the following code?()   String a = "hello";   String b = new String(a);   String c = a;   char[] d = { ’h’, ’e’, ’l’, ’l’, ’o’ };  

  • A、(a == "Hello")
  • B、(a == b)
  • C、(a == c)
  • D、a.equals(b)
  • E、a.equals(d)

正确答案:C,D

第5题:

下面的哪些程序片断可能导致错误() 

  • A、String s = "Gone with the wind";  String t = " good ";  String k = s + t;
  • B、String s = "Gone with the wind";  String t;  t = s[3] + "one";
  • C、String s = "Gone with the wind";  String standard = s.toUpperCase();
  • D、String s = "home directory"; String t = s - "directory"

正确答案:B,D

第6题:

Given:String[]elements={"for","tea","too"};Stringfirst=(elements.length>0)?elements[0]:null;Whatistheresult?()

A.Compilationfails.

B.Anexceptionisthrownatruntime.

C.Thevariablefirstissettonull.

D.Thevariablefirstissettoelements[0].


参考答案:D

第7题:

下面哪个方法设置MIME类型?()

  • A、setHeader(String headerName,String headerValue)
  • B、setContentType(String mimeType)
  • C、setContentLength(int length)
  • D、addCookie(Cookie c)
  • E、addHeader(String name,String value)

正确答案:B

第8题:

String[]elements={for”,tea”,too”};Stringfirst=(elements.length>0)?elements[0]null;Whatistheresult?()

A.Compilationfails.

B.Anexceptionisthrownatruntime.

C.Thevariablefirstissettonull.

D.Thevariablefirstissettoelements[0].


参考答案:D

第9题:

Which statement is true for the class java.util.HashSet? () 

  • A、 The elements in the collection are ordered.
  • B、 The collection is guaranteed to be immutable.
  • C、 The elements in the collection are guaranteed to be unique.
  • D、 The elements in the collection are accessed using a unique key.
  • E、 The elements in the collections are guaranteed to be synchronized.

正确答案:C

第10题:

Which declarations will allow a class to be started as a standalone program?()  

  • A、public void main(String args[])
  • B、public void static main(String args[])
  • C、public static main(String[] argv)
  • D、final public static void main(String [] array)
  • E、public static void main(String args[])

正确答案:D,E

更多相关问题