indexOf(Strings,intbegin_index)是从字符串s中第begin_index+1字符处开始检索
第1题:
A.Strings="john"+"was"+"here";
B.Strings="john"+3;
C.inta=3+5;
D.inta=5+5.5;
第2题:
A.Strings=c.readLine();
B.char[]c=c.readLine();
C.Strings=c.readConsole();
D.char[]c=c.readConsole();
E.Strings=c.readLine("%s","name");
F.char[]c=c.readLine("%s","name");
第3题:
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";
第4题:
下面这段代码会产生( )个String对象。
Strings1="hello";
Strings2=s1.substring(2,3);
Strings3=s1.toString();
Strings4=newStringBuffer(s1).toString();
A、1
B、2
C、3
D、4
第5题:
Why we use StringBuffer when concatenating strings?
第6题:
已知Strings="ABCDEFGHIJABC",以下说法错误的是()
A.s.indexOf("C")等于2
B.s.indexOf("EFG",2)等于4
C.s.indexOf("A",7)等于10
D.s.indexOf("D",4)等于3
第7题:
importjava.util.*;publicclassLetterASort{publicstaticvoidmain(String[]args){ArrayListstrings=newArrayList();strings.add(?aAaA”);strings.add(”AaA”);strings.add(?aAa”);strings.add(”AAaa”);Collections.sort(strings);for(Strings:strings){System.out.print(s+);}}}Whatistheresult?()
A.Compilationfails.
B.aAaAaAaAAaaAaA
C.AAaaAaAaAaaAaA
D.AaAAAaaaAaAaAa
E.aAaAaAaAaAAAaa
F.Anexceptionisthrownatruntime.
第8题:
A.mid(2,s)
B.charAt(2)
C.s.indexOf(“v”)
D.indexOf(s,”v”)
第9题:
已知有定义:Strings="story",下面()表达式是合法的。
A.s+="books";
B.charC=s[1];
C.intlen=s.length;
D.Strings=s.toLowerCase();
第10题:
设有定义:Strings=“World”;,下列语句错误的是( )。
A、intm=s.indexOf(‘r’);
B、charc=s.charAt(0);
C、intn=s.length();
D、Stringstr=s.append(‘2’);