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

题目内容 (请给出正确答案)

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.

参考答案

更多 “ 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.” 相关考题
考题 在Java语言中,能够实现字符串连接的方法是()A.String sub string(intstart point)B.String concat(Strings)C.String replace(charold,charnew)D.String trim()

考题 下面的哪些程序段可能导致错误? ( ) Ⅰ: String s = "Gone with the wind"; String t = "good "; String k = s + t; Ⅱ: String s = "Gone with the wind"; String t; t = s[3] + "one"; Ⅲ: String s = "Gone with the wind"; String standard = s.toUpperCase(); Ⅳ: String s = "home directory"; String t = s-"directory":A.Ⅱ、ⅢB.Ⅱ、ⅣC.Ⅰ、ⅣD.Ⅲ、Ⅳ

考题 下列程序段运行的结果为 public class Test{ static void print(String s,int i){ System.out.println("String:"+s+",int:"+i); } static void print(int i,String s){ System.out.println("int:"+i+",String:"+s); } public static void main(String[]args){ print(99,"Int first"); } }A.String:String first,int:11B.int:11,String:Int firstC.String:String first,int99D.int:99,String:Int first

考题 阅读下列程序说明和C++程序,把应填入其中(n)处的字句,写对应栏内。【说明】下面的程序实现了类String的构造函数、析构函数和赋值函数。已知类String的原型为:class String{public:String(coust char * str = NULL); //普通构造函数String( const String other); //拷贝构造函数~String(void); //析构函数String perate =(const String other); //赋值函数private:char * m_data; // 用于保存字符串};//String 的析构函数String:: ~String (void){(1);}//String 的普通构造函数String: :String( const char * str){if (2){m_data = new char[1];*m_data = '\0';}else{int length = strlen(str);m_data = new ehar[ length + 1 ];strepy(m_data, str);}}//拷贝的构造函数String:: String( const String other){ int length = strlen(other. m_data);m_data = new char[ length + 1 ];strepy(m_data, other, m_data); //赋值函数String String::operate = (eonst String other) //{if (3)return * this;delete [] m_clara; //释放原有的内存资源int length = strlen( other, m_data);m_data = new chart length + 1 ];(4);return (5);}

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

考题 下列的哪个程序段可能导致错误? ( )A.String s="hello"; String t="good"; String k=s+t;B.String s="hello"; String t; t=s[3]+"one";C.String s="hello"; String standard=s.toUpperCase();D.String s="hello"; String t=s+"good";

考题 下列程序段运行的结果为 public class Test{ static void print(String s,int i){ System.out.println("String:"+s+",int:"+i); } static void print(int i, String s){ System.out.println("int:"+i+",String:"+s); } public static void main(String [] args){ print(99,"Int first"); } }A.String:Stringfirst,int:11B.int:11,String:Int firstC.String:String first,int:99D.int:99,String:int first

考题 下列字符串中非法字符串为( )。A.’a string’B.’It is a’string’.’C.”a string”D.”It is a’string”

考题 已知String类定义如下:class String{public:String(const char *str = NULL); // 通用构造函数String(const String another); // 拷贝构造函数~ String(); // 析构函数String perater =(const String rhs); // 赋值函数private:char *m_data; // 用于保存字符串};尝试写出类的成员函数实现。

考题 编写类 String 的构造函数、析构函数和赋值函数已知类 String的原型为:class String{public:String(const char *str = NULL); // 普通构造函数String(const String other); // 拷贝构造函数~ String(void); // 析构函数String perate =(const String other); // 赋值函数private:char *m_data; // 用于保存字符串};请编写 String的上述 4 个函数。

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

考题 下面的哪些程序片断可能导致错误() 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"

考题 下面哪个是对字符串String的正确定义()。A、String s1=null;B、String s2=’null’;C、String s3=(String)‘abc’;D、String s4=(String)‘/uface’;

考题 下列不是 String 类的方法的是()A、charAt(int index)B、indexOf(String s)C、beginWith(String s)D、endsWith(String s)

考题 下面哪些语句能够正确地生成5个空字符串?()A、String a[]=new String[5];for(int i=0;i5;a[i++]=“”);B、String a[]={“”,“”,“”,“”,“”};C、String a[5];D、String[5]a;E、String[]a=new String[5];for(int i=0;i5;a[i++]=null);

考题 执行语句“stringstr("abc");”时,系统会自动调用string类的构造函数()。A、string()B、string(constchar*s)C、string(conststringstr)D、string(size_typen,charc)

考题 下面字符串中非法字符串为().A、’a string’B、"a string"C、’It is a’string’’D、"It is a’string.’"

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

考题 在JAVA EE中,request对象的()方法可以获取页面请求中一个表单组件对应多个值时的用户的请求数据。A、String getParameter(String name)B、String[] getParameter(String name)C、String getParameterValuses(String name)D、String[] getParameterValues(String name)

考题 String s=new String("xyz");创建了几个String Object?

考题 下列Map的泛型声明中正确的是哪项?()  A、Map〈String〉B、Map〈String,String〉C、Map(String)D、Map()

考题 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";

考题 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[ /.] +“;

考题 单选题下面哪个方法设置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)

考题 问答题String s = new String("xyz");创建了几个String Object?

考题 单选题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[ /.] +“;

考题 单选题下列不是 String 类的方法的是()A charAt(int index)B indexOf(String s)C beginWith(String s)D endsWith(String s)

考题 单选题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[/.]+";