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

题目内容 (请给出正确答案)
单选题
Which methods from the String and StringBuffer classes modify the object on which they are called?()
A

The charAt() method of the String class.

B

The toUpperCase() method of the String class.

C

The replace() method of the String class.

D

The reverse() method of the StringBuffer class.

E

The length() method of the StringBuffer class.


参考答案

参考解析
解析: 暂无解析
更多 “单选题Which methods from the String and StringBuffer classes modify the object on which they are called?()A The charAt() method of the String class.B The toUpperCase() method of the String class.C The replace() method of the String class.D The reverse() method of the StringBuffer class.E The length() method of the StringBuffer class.” 相关考题
考题 以下代码有问题,下列说法正确的是()。代码如下:public A{public void method(){} (1)public string method(){} (2)public string method(int a){} (3)} A、(1)和(2)删掉一个,错误解决B、(3)删掉,错误解决C、没问题

考题 You are writing a method that accepts a string parameter named message.Your method must break the message parameter into individual lines of text and pass each line to a second method named Process.Which code segment should you use?()A.B.C.D.

考题 You are creating a Windows Communication Foundation (WCF) service that implements operations in a RESTful manner. You need to add a delete operation. You implement the delete method as follows:void DeleteItems(string id);You need to configure WCF to call this method when the client calls the service with the HTTP DELETE operation. What should you do?()A. Add the WebInvoke(UriTemplate=/Items/{id}, Method=DELETE) attribute to the operationB. Add the HttpDelete atribute to the operationC. Replace the string parameter with a RemovedActivityAction parameterD. Replace the return type with RemovedActivityAction.

考题 A method returning length of the String.

考题 public class CreditCard {  private String cardlD;  private Integer limit;  public String ownerName;  public void setCardlnformation(String cardlD,  String ownerName, 28. Integer limit) {  this.cardlD = cardlD;  this.ownerName = ownerName;  this.limit = limit;  }  } Which is true?() A、 The class is fully encapsulated.B、 The code demonstrates polymorphism.C、 The ownerName variable breaks encapsulation.D、 The cardlD and limit variables break polymorphism.E、 The setCardlnformation method breaks encapsulation.

考题 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、 1B、 2C、 3D、 4E、 5F、 6

考题 You are creating a Windows Communication Foundation (WCF) service that implements operations in a RESTful manner.You need to add a delete operation. You implement the delete method as follows. string void DeleteItems(string id);You need to configure WCF to call this method when the client calls the service with the HTTP DELETE operation. What should you do?()A、 Add the WebInvoke(UriTemplate = "/Items/{id}",Method="DELETE") attribute to the operation.B、 Add the HttpDelete attribute to the operation.C、 Replace the string parameter with a RemovedActivityAction parameter.D、 Replace the return type with RemovedActivityAction.

考题 Which statements concerning the methods notify() and notifyAll() are true?  A、Instances of class Thread have a method called notify().B、A call to the method notify() will wake the thread that currently owns the monitor of the object.C、The method notify() is synchronized.D、The method notifyAll() is defined in class Thread.E、When there is more than one thread waiting to obtain the monitor of an object, there is no way to be  sure which thread will be notified by the notify() method.

考题 A programmer needs to create a logging method that can accept an arbitrary number of arguments. For example, it may be called in these ways:  logIt(”log message 1 “);  logIt(”log message2”,”log message3”);  logIt(”log message4”, “log message5”, “log message6);  Which declaration satisfies this requirement?()A、 public void logIt(String * msgs)B、 public void logIt(String [] msgs)C、 public void logIt(String... msgs)D、 public void logIt(String msg1, String msg2, String msg3)

考题 Under which circumstances will a thread stop?()  A、The method waitforId() in class MediaTracker is called.B、The run() method that the thread is executing ends.C、The call to the start() method of the Thread object returns.D、The suspend() method is called on the Thread object.E、The wait() method is called on the Thread object.

考题 Which methods from the String and StringBuffer classes modify the object on which they are called?()  A、The charAt() method of the String class.B、The toUpperCase() method of the String class.C、The replace() method of the String class.D、The reverse() method of the StringBuffer class.E、The length() method of the StringBuffer class.

考题 public class MyLogger {  private StringBuilder logger = new StringBuuilder();  public void log(String message, String user) {  logger.append(message);  logger.append(user);  }  }  The programmer must guarantee that a single MyLogger object works properly for a multi-threaded system. How must this code be changed to be thread-safe?() A、 synchronize the log methodB、 replace StringBuilder with StringBufferC、 No change is necessary, the current MyLogger code is already thread-safe.D、 replace StringBuilder with just a String object and use the string concatenation (+=) within the log method

考题 Which of the following fragments might cause errors?()    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";

考题 Which HttpSession method stores an object in a session?()A、 put(String name. Object value)B、 set(String name. Object value)C、 setAttribute(String name. Object value)D、 putAttribute(String name. Object value)E、 addAttribute(String name. Object value)

考题 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.

考题 You are creating a Windows Communication Foundation (WCF) service that implements operations in a RESTful manner. You need to add a delete operation. You implement the delete method as follows:void DeleteItems(string id);You need to configure WCF to call this method when the client calls the service with the HTTP DELETE operation. What should you do?()A、Add the WebInvoke(UriTemplate="/Items/{id}", Method="DELETE") attribute to the operationB、Add the HttpDelete atribute to the operationC、Replace the string parameter with a RemovedActivityAction parameterD、Replace the return type with RemovedActivityAction.

考题 单选题Given this method in a class:  public String toString() {  StringBuffer buffer = new StringBuffer();  buffer.append(‟‟);  return buffer.toString();  }  Which is true?()A  This code is NOT thread-safe.B  The programmer can replace StringBuffer with StringBuilder with no other changes.C  This code will perform well and converting the code to use StringBuilder will not enhance the performance.D  This code will perform poorly. For better performance, the code should be rewritten: return ““+ this.name + “”;

考题 多选题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?()AThe function method must have the signature: public String spin().BThe method must be mapped to the logical name spin in the web.xml file.CThe function method must have the signature: public String spinIt().DThe function method must have the signature public static String spin().EThe function method must have the signature: public static String spinIt().FThe function class must be named Spinner, and must be in the package com.example.

考题 多选题Which statements concerning the methods notify() and notifyAll() are true?AInstances of class Thread have a method called notify().BA call to the method notify() will wake the thread that currently owns the monitor of the object.CThe method notify() is synchronized.DThe method notifyAll() is defined in class Thread.EWhen there is more than one thread waiting to obtain the monitor of an object, there is no way to be  sure which thread will be notified by the notify() method.

考题 单选题public class MyLogger {  private StringBuilder logger = new StringBuuilder();  public void log(String message, String user) {  logger.append(message);  logger.append(user);  }  }  The programmer must guarantee that a single MyLogger object works properly for a multi-threaded system. How must this code be changed to be thread-safe?()A  synchronize the log methodB  replace StringBuilder with StringBufferC  No change is necessary, the current MyLogger code is already thread-safe.D  replace StringBuilder with just a String object and use the string concatenation (+=) within the log method

考题 单选题You are creating a Windows Communication Foundation (WCF) service that implements operations in a RESTful manner.You need to add a delete operation. You implement the delete method as follows. string void DeleteItems(string id);You need to configure WCF to call this method when the client calls the service with the HTTP DELETE operation. What should you do?()A  Add the WebInvoke(UriTemplate = /Items/{id},Method=DELETE) attribute to the operation.B  Add the HttpDelete attribute to the operation.C  Replace the string parameter with a RemovedActivityAction parameter.D  Replace the return type with RemovedActivityAction.

考题 单选题A programmer needs to create a logging method that can accept an arbitrary number of arguments.Forexample,it may be called in these ways: logIt("log message 1"); logIt("log message 2”,”log message 3"); logIt("log message 4","log message 5","log message 6"); Which declaration satisfies this requirement()?A public void logIt(String*msgs)B public void logIt(String[]msgs)C public void logIt(String...msgs)D public voidl ogIt(Stringmsg1,Stringmsg2,Stringmsg3)

考题 单选题Which HttpSession method stores an object in a session?()A  put(String name. Object value)B  set(String name. Object value)C  setAttribute(String name. Object value)D  putAttribute(String name. Object value)E  addAttribute(String name. Object value)

考题 单选题Which methods from the String and StringBuffer classes modify the object on which they are called?()A The charAt() method of the String class.B The toUpperCase() method of the String class.C The replace() method of the String class.D The reverse() method of the StringBuffer class.E The length() method of the StringBuffer class.

考题 单选题A programmer needs to create a logging method that can accept an arbitrary number of arguments. For example, it may be called in these ways:  logIt(”log message 1 “);  logIt(”log message2”,”log message3”);  logIt(”log message4”, “log message5”, “log message6);  Which declaration satisfies this requirement?()A  public void logIt(String * msgs)B  public void logIt(String [] msgs)C  public void logIt(String... msgs)D  public void logIt(String msg1, String msg2, String msg3)

考题 单选题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  1B  2C  3D  4E  5F  6

考题 单选题Which retrieves the value associated with “foo” from within an HttpServlet?()A  String value = getServletConfig( ).getParameter(“foo”);B  String value = getServletContext( ).getAttribute(“foo”);C  Object value = getServletContext( ).getInitParameter(“foo”);D  String value = getServletContext( ).getInitParameter(“foo”)

考题 ( 难度:中等)某Java类JavaTest有一个方法,此方法包含一个形参,返回值类型为int类型,使用其类名就可以调用其方法,其方法头可能为()A.static int method(String str)B.public int method(String str)C.static void method()  D.abstract int method(String str)E.public static int method(String str)