单选题byteb[]="今天星期六".getBytes();Strings=newString(b,4,6);则s为()A天星期六B星期六C期六D今天是
单选题
byteb[]="今天星期六".getBytes();Strings=newString(b,4,6);则s为()
A
天星期六
B
星期六
C
期六
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都不执行
下面哪段语法执行正确() A.Strings=Gonewiththewind;Stringt=good;Stringk=s+t;B.Strings=Gonewiththewind;Stringt;t=s[3]+one;C.Strings=Gonewiththewind;Stringstandard=s.toUpperCase();D.Strings=homedirectory;Stringt=s-directory;
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
下列语句输出结果为( )。 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.编译错误
阅读下面程序 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.编译错误
使用GET方式提交数据,接收数据时,处理中文最直接有效方式为()。A、request.setCharacterEncoding("utf-8")B、response.setContentType("text/html;charset=utf-8")C、Stringname=newString(request.getParameter("name").getBytes("ISO-8859-1"),"gbk")D、response.setCharacterEncoding("gbk")
创建字符串s:Strings=newString(“hello”);以下()语句将改变s。A、s.append(“aaa”)B、s.concat(s)C、s.substring(3)D、以上语句都不会
单选题有如下程序段:inta=b=5;Strings1="祝你今天考出好成绩!";Strings2=s1;则表达式a==b与s2==s1的结果分别是:()。Atrue与trueBfalse与trueCtrue与falseDfalse与false
单选题创建字符串s:Strings=newString(“hello”);以下()语句将改变s。As.append(“aaa”)Bs.concat(s)Cs.substring(3)D以上语句都不会