单选题创建字符串s:Strings=newString(“hello”);以下()语句将改变s。As.append(“aaa”)Bs.concat(s)Cs.substring(3)D以上语句都不会

单选题
创建字符串s:Strings=newString(“hello”);以下()语句将改变s。
A

s.append(“aaa”)

B

s.concat(s)

C

s.substring(3)

D

以上语句都不会


参考解析

解析: 暂无解析

相关考题:

关于以下程序段,正确的说法是() 1.Strings1=”abc” ”def”; 2.Strings2=newString(s1); 3.if(s1==s2) 4.System.out.println(“==succeeded”); 5.if(s1.equals(s2)) 6.System.out.println(“.equals()succeeded”); A.行4与行6都将执行B.行4执行,行6不执行C.行6执行,行4不执行D.行 4、行6都不执行

创建字符串s:String s=new String(“abcd”);以下 将改变s。() A.s.append(“x”);B.s.concat(“y”);C.s.substring(3);D.以上语句都不会

假设有以下代码: String s="hello"; String t="hello"; char c[ ]={'h','e','l','l','o'}; 下列选项中,返回false的语句是______。A.s.equals(t);B.t.equals(c);C.s==t;D.t.equals(new String("hello"));

importjava.util.*;publicclassWrappedString{privateStrings;publicWrappedString(Strings){this.s=s;}publicstaticvoidmain(String[]args){HashSeths=newHashSet();WrappedStringws1=newWrappedString(”aardvark”);WrappedStringws2=newWrappedString(”aardvark”);Strings1=newString(”aardvark”);Strings2=newString(”aardvark”);hs.add(ws1);hs.add(ws2);hs.add(s1);hs.add(s2);System.out.println(hs.size());}}Whatistheresult?()A.0B.1C.2D.3E.4F.Compilationfails.G.Anexceptionisthrownatruntime.

Strings=hello;Stringt=hello;charc[]={’h’,’e’,’l’,’l’,’o’};Whichreturntrue?() A.s.equals(t);B.t.equals(c);C.s==t;D.t.equals(newString(hello));E.t==c;

publicclassX{publicstaticvoidmain(String[]args){strings=newstring(Hello”);modify(s);System.out.printIn(s);}publicstaticvoidmodify(Strings){s+=world!”;}}Whatistheresult?() A.Theprogramrunsandprints“Hello”B.Anerrorcausescompilationtofail.C.Theprogramrunsandprints“Helloworld!”D.Theprogramrunsbutabortswithanexception.

publicclassX{publicstaticvoidmain(Stringargs){strings=newstring(Hello”);modify(s);System.out.printIn(s);}publicstaticvoidmodify(Strings){s+=world!”;}}Whatistheresult?() A.Theprogramrunsandprints“Hello”B.Anerrorcausescompilationtofail.C.Theprogramrunsandprints“Helloworld!”D.Theprogramrunsbutabortswithanexception.

以下选项中正确的语句组是( )。A)char s[];s="HELLO!";B)char*s;s={"HELLO!"};C)char s[10];s="HELLO!";D)char *s;s="HELLO!";

下列代码的执行结果是()。publicclasstest5{publicstaticvoidmain(Stringargs[]){Strings1=newString("hello");Strings2=newString("hello");System.out.prim(s1==s2);System.out.print(",");System.out.println(s1.equals(s2));}A.true,falseB.true,trueC.false,trueD.false,false

下列语句输出结果为( )。 public class test { public static void main (String args[]) { Strings1=newString("HOW"); Strings2=newString("How"); System.out.println(!(s1.equals(s2))): } }A.假B.真C.0D.1

下列语句输出结果为( )。 public class test { public static void main(String args[]) String s1 =newString("HOW"); String s2=newString("How"): System.out.pnntln(!(s1.equals(s2))); } }A.假B.真C.0D.1

下面的程序执行后,屏幕上显示的应是()。PubhcclassExam{publicstaticvoidmain(String[]args){charchar1[]={'t','e','s','t'};charchat2[]={'t','e','s','t','1'}Sbings1=newString(char1);Strings2=newString(char2,0,4);System.out.println(s1.equals(s2));}}A.真B.假C.testD.编译错误

以下选项中正确的语句组是( )。A.char s[]; s="HELLO!";B.char *s; s={"HELLO!"};C.char s[10]; s="HELLO!";D.char *s; s="HELLO!";

阅读下面程序 publicclass Operators AndExpressions{ voidequalsMethodl(){ Strings1=newString("howareyou"); Strings2=newString("howareyou"); System.out.println(s1==s2); } publicstaticvoidmain(Stringargs[]){ OperatorsAndExpressionsOperAndExp=newOperatorsAndExpressions (); //用于复合类型数据的“==”运算符 OperAndExp.equalsMethodl(); } } 程序运行结果是( )。A.==B.trueC.falseD.equal

创建字符串s:String s=new String("xyzy"):以下( )将改变s。A.s.append("a")B.s.concat("s")C.s.substring(3)D.以上语句都不会

下面的程序执行后,屏幕上显示的应是( )。 publicclassExam{ publicstaticvoidmain(String[]args){ charcharl[]={'t','e','s','t'}; charchar2[]={'t','e,'s','t','1'}; Strings1=newString(char1); Strings2=newString(char2,0,4); System.out.println(s1.equals(S2)); } }A.trueB.falseC.testD.编译错误

下面这段代码会产生( )个String对象。Strings1="hello";Strings2=s1.substring(2,3);Strings3=s1.toString();Strings4=newStringBuffer(s1).toString();A、1B、2C、3D、4

执行代码Strings=newString("Hello")后,正确的结论是()A、s最后一个索引值为5B、s的值和"Hello"并不一样C、s.length为4D、s.length为5

Strings=newString(c,0,4)指把数组c中从索引0到索引4的字符提取出来,赋值给s

设String对象s="H",运行语句System.out.println(s.concat("ello!"));后String对象s的内容为"Hello!",所以语句输出为"Hello!"。

如果需要把s="It,is,me"按照","分解,并赋给新的变量s1,下列语句正确的是()A、Strings1=newStringTokenizer(s);B、Strings1=newStringTokenizer(s,",");C、StringTokenizers1=newStringTokenizer("It,is,me");D、StringTokenizers1=newStringTokenizer(s,",");

booleanendsWith(Strings)表示()A、查找某字符串是否以s为结尾B、查找某字符串是否与s完全匹配C、确定某字符串与s的大小关系D、确定某字符串是否以s为开始

创建字符串s:Strings=newString(“hello”);以下()语句将改变s。A、s.append(“aaa”)B、s.concat(s)C、s.substring(3)D、以上语句都不会

欲为字符串S1输入”Hello World!”,其语句是()。

判断题设String对象s="H",运行语句System.out.println(s.concat("ello!"));后String对象s的内容为"Hello!",所以语句输出为"Hello!"。A对B错

单选题booleanendsWith(Strings)表示()A查找某字符串是否以s为结尾B查找某字符串是否与s完全匹配C确定某字符串与s的大小关系D确定某字符串是否以s为开始

单选题有语句Strings=”helloworld”;,以下操作哪个是不合法的?()Ainti=s.length()Bs=3CStringts=s.trim()DStringt=s+”!”