网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
String类的方法 replace (CharSequence srt1, CharSequence srt2)返回一个新的字符串,它是通过用srt2替换此字符串中出现的所有 srt1得到的
参考答案
更多 “String类的方法 replace (CharSequence srt1, CharSequence srt2)返回一个新的字符串,它是通过用srt2替换此字符串中出现的所有 srt1得到的” 相关考题
考题
在Java语言中,能够实现字符串连接的方法是()A.String sub string(intstart point)B.String concat(Strings)C.String replace(charold,charnew)D.String trim()
考题
下面程序的输出结果是什么? class Foo{ static void change(String s){ s=s.replace('j','l'); } public static void main(String args[]){ String s="java"; change(s); System.out.println(s); } }()A.lavaB.javaC.编译错误D.运行时出现异常
考题
下列程序的输出结果是( )。 public class Test { public static void main (String[] args) { String s="hello"; s.replace ('r','m'); System.out.println(s); } }A.helloB.HELLOC.hemmoD.HEMMO
考题
Public class test ( Public static void stringReplace (String text) ( Text = text.replace (‘j’ , ‘i’); ) public static void bufferReplace (StringBuffer text) ( text = text.append (“C”) ) public static void main (String args[]} ( String textString = new String (“java”); StringBuffer text BufferString = new StringBuffer (“java”); stringReplace (textString); BufferReplace (textBuffer); System.out.printLn (textString + textBuffer); ) ) What is the output?()
考题
String a = “ABCD”; String b = a.toLowerCase(); b.replace(‘a’, ‘d’); b.replace(‘b’, ‘c’); System.out.println(b); What is the result? () A、 abcdB、 ABCDC、 dccdD、 dcbaE、 Compilation fails.F、 An exception is thrown at runtime.
考题
下列类Account的构造方法中,声明正确的是?() A、Account (String name)()B、Account (String name)C、Account (name)()D、NewAccount (String name)()
考题
下列不是 String 类的方法的是()A、charAt(int index)B、indexOf(String s)C、beginWith(String s)D、endsWith(String s)
考题
File类的方法中,用于列举某目录下的子目录及文件的方法是()A、long length()B、long lastModified()C、String [] list()D、String getName()
考题
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
考题
单选题下列类Account的构造方法中,声明正确的是?()A
Account (String name)()B
Account (String name)C
Account (name)()D
NewAccount (String name)()
考题
判断题String类的方法 replace (CharSequence srt1, CharSequence srt2)返回一个新的字符串,它是通过用srt2替换此字符串中出现的所有 srt1得到的A
对B
错
考题
单选题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
考题
单选题String a = “ABCD”; String b = a.toLowerCase(); b.replace(‘a’, ‘d’); b.replace(‘b’, ‘c’); System.out.println(b); What is the result? ()A
abcdB
ABCDC
dccdD
dcbaE
Compilation fails.F
An exception is thrown at runtime.
考题
单选题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 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 test ( Public static void stringReplace (String text) ( Text = text.replace („j„ , „i„); ) public static void bufferReplace (StringBuffer text) ( text = text.append (“C”) ) public static void main (String args ){ String textString = new String (“java”); StringBuffer text BufferString = new StringBuffer (“java”); stringReplace (textString); BufferReplace (textBuffer); System.out.printIn (textString + textBuffer); } ) What is the output?()
考题
单选题下列不是 String 类的方法的是()A
charAt(int index)B
indexOf(String s)C
beginWith(String s)D
endsWith(String s)
热门标签
最新试卷