Strings=newString(c,0,4)指把数组c中从索引0到索引4的字符提取出来,赋值给s
Strings=newString(c,0,4)指把数组c中从索引0到索引4的字符提取出来,赋值给s
相关考题:
以下各选项中能正确声明一个表示50个值为null的字符串数组的是( )。A.string[]a;B.string a[];C.chara[50][]D.stringa[]=newString[50]
下式中给字符串数组正确赋值的语句是()。 A.Stringtemp[]=newString{"j""a""z"};B.Stringtemp[]={"j""b""c"};C.Stringtemp={"a","b","c"};D.Stringtemp[]={"a","b","c"};
importjava.util.*;2.publicclassTest{3.publicstaticvoidmain(String[]args){4.Liststrings=newArrayList();5.//insertcodehere6.}7.}Whichfour,insertedatline5,willallowcompilationtosucceed?() A.Strings=strings.get(0);B.Iteratori1=strings.iterator();C.String[]array1=strings.toArray();D.Iteratori2=strings.iterator();E.String[]array2=strings.toArray(newString[1]);F.Iteratori3=strings.iterator();
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(String[]args){Strings1=newString(true”);Booleanb1=newBoolean(true);if(s2.equals(b1)){System.out.printIn(Equal”);}}}Whatistheresult?() A.Theprogramrunsandprintsnothing.B.Theprogramrunsandprints“Equal”C.Anerroratline5causescompilationtofail.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.
publicclassX{publicstaticvoidmain(Stringargs){Strings1=newString(true”);Booleanb1=newBoolean(true);if(s2.equals(b1)){System.out.printIn(Equal”);}}}Whatistheresult?() A.Theprogramrunsandprintsnothing.B.Theprogramrunsandprints“Equal”C.Anerroratline5causescompilationtofail.D.Theprogramrunsbutabortswithanexception.
下列代码的执行结果是()。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
下面的程序执行后,屏幕上显示的应是()。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.编译错误
阅读下面程序 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
下面的程序执行后,屏幕上显示的应是( )。 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.编译错误
下列哪个语句是声明了一个含有10个string对象的数组()。A、char str[];B、char str[][];C、string str[]=newstring[10];D、string str[10];
下面这行代码String[][]s=newString[10][];的正确陈述是()A、该行代码非法B、s是一10行10列的数组C、s是一包含10个一维数组的二维数组D、s中每个元素设为""
单选题在ASP.NET中,下面定义数组的方法中哪个是正确的?()AString[]aryName=newString[3]BString[]aryName=newString[]CString[3]aryName=newString[3]DStringaryName1[]=newString[3]
单选题在Java中,关于类与对象的说法,正确的是()A代码:strings=newstring();中的string是类,s是对象B对像包括类,类是对象有具体表现C对象拥有自己的行为和属性,和对应的类没有关系D学生,可以看作是张三类或者李四类的对象
单选题创建字符串s:Strings=newString(“hello”);以下()语句将改变s。As.append(“aaa”)Bs.concat(s)Cs.substring(3)D以上语句都不会
单选题下列哪个语句是声明了一个含有10个string对象的数组()。Achar str[];Bchar str[][];Cstring str[]=newstring[10];Dstring str[10];