题目详情
当前位置:首页 > 职业培训考试
题目详情:
发布时间:2023-10-21 10:57:07

[单项选择] 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 = "的相关试题:

[单项选择] 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[ /.] +“;
[单项选择] 11. String test = “This is a test”;  12. String[] tokens = test.split(”/s”);  13. System.out.println(tokens.length);  What is the result?() 
A.  0
B.  1
C.  4
D.  Compilation fails.
E.  An exception is thrown at runtime.
[单项选择] String a = “ABCD”;  String b = a.toLowerCase();  b.replace(‘a’, ‘d’);  b.replace(‘b’, ‘c’);  System.out.println(b);   What is the result? () 
A.  abcd
B.  ABCD
C.  dccd
D.  dcba
E.  Compilation fails.
F.  An exception is thrown at runtime.
[填空题] 5. String foo = “base”;   6. foo.substring(0,3);   7. foo.concat(“ket”)  8.   Type the value of foo at line 8.()
[填空题] 3. string foo = “ABCDE”;  4. foo.substring(3);  5. foo.concat(“XYZ”);  6.     Type the value of foo at line 6.()
[多项选择] 35. String #name = “Jane Doe”;  36. int$age=24;  37. Double_height = 123.5;  38. double~temp = 37.5;  Which two are true?()
A.  Line 35 will not compile.
B.  Line 36 will not compile.
C.  Line 37 will not compile.
D.  Line 38 will not compile.
[单项选择] 12. String csv = “Sue,5,true,3”;  13. Scanner scanner = new Scanner( csv);  14. scanner.useDelimiter(”,”);  15. int age = scanner.nextInt();  What is the result?() 
A.  Compilation fails.
B.  After line 15, the value of age is 5.
C.  After line 15, the value of age is 3.
D.  An exception is thrown at runtime.
[单项选择] String foo = “blue”;    Booleanbar = new Boolean [1];    if (bar[0]) {    foo = “green”;    }   What is the result?()  
A.  Foo has the value of “”
B.  Foo has the value of null.
C.  Foo has the value of “blue”
D.  Foo has the value of “green”
E.  An exception is thrown.
F.  The code will not compile.
[单项选择] 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 c
B.  1 2 3
C.  a1b2c3
D.  a1 b2 c3
E.  Compilation fails.
F.  The code runs with no output.
G.  An exception is thrown at runtime.
[单项选择] 现有代码片段:      String  s="123";      String sl=S+456;  请问sl的结果是哪项?()     
A.  123456
B.  579
C. 编译错误
D. 运行时抛出异常
[单项选择] 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.  An exception is thrown at runtime.
B.  1
C.  4
D.  Compilation fails.
E.  0
[单项选择] public String makinStrings() {  String s = “Fred”;  s = s + “47”;  s = s.substring(2, 5);  s = s.toUpperCase();  return s.toString();  }  How many String objects will be created when this method is invoked?() 
A.  1
B.  2
C.  3
D.  4
E.  5
F.  6
[单项选择] public static void test(String str) { int check = 4;  if (check = str.length()) {  System.out.print(str.charAt(check -= 1) +“, “);  } else {  System.out.print(str.charAt(0) + “, “);  }  }  and the invocation:  test(”four”);  test(”tee”); test(”to”);  What is the result?() 
A.  r, t, t,
B.  r, e, o,
C.  Compilation fails.
D.  An exception is thrown at runtime.
[单项选择] class Sock2 {   String color;   public boolean equals(Object o) {   return color.equals(((Sock2)o).color);   } }   class TestSocks {   public static void main(String [] args) {   Sock2 s1 = new Sock2(); s1.color = "blue";   Sock2 s2 = new Sock2(); s2.color = "blue";   if (s1.equals(s2)) System.out.print("equals ");   if (s1 == s2) System.out.print("== ");   }   }   结果为:()      
A. ==
B. equals
C. equals ==
D. 无结果输出
[多项选择] Given: String value = getServletContext().getInitParameter("foo"); in an HttpServlet and a web applicationdeployment descriptor that contains: foo frodo Which two are true?()
A. The foo initialization parameter CANNOT be set programmatically.
B. Compilation fails because getInitParameter returns type Object.
C. The foo initialization parameter is NOT a servlet initialization parameter.
D. Compilation fails because ServletContext does NOT have a getInitParameter method.
E. The foo parameter must be defined within the  element of the deployment descriptor.
[单项选择] int index = 1;  String [] test = new String[3];  String foo = test[index];     What is the result?()  
A.  Foo has the value “”
B.  Foo has the value null
C.  An exception is thrown
D.  The code will not compile
[多项选择] class Sock {  String size;  String color;  public boolean equals(Object o) {  Sock s = (Sock) o;  return color.equals(s.color);   }  // insert code here  }  哪两个满足 hashCode 的约定?()
A. public int hashCode() { return 343; }
B. public int hashCode() { return size.hashCode (); }
C. public int hashCode() { return color.hashCode (); }
D. public int hashCode() { return (int) (Math.random() * 1000);

我来回答:

购买搜题卡查看答案
[会员特权] 开通VIP, 查看 全部题目答案
[会员特权] 享免全部广告特权
推荐91天
¥36.8
¥80元
31天
¥20.8
¥40元
365天
¥88.8
¥188元
请选择支付方式
  • 微信支付
  • 支付宝支付
点击支付即表示同意并接受了《购买须知》
立即支付 系统将自动为您注册账号
请使用微信扫码支付

订单号:

请不要关闭本页面,支付完成后请点击【支付完成】按钮
恭喜您,购买搜题卡成功
重要提示:请拍照或截图保存账号密码!
我要搜题网官网:https://www.woyaosouti.com
我已记住账号密码