一个网络协议
一个文件
包含网络协议、计算机域名的字符串
操作系统名称
第1题:
classMineral{staticStringshiny(){return"1";}}classGraniteextendsMineral{publicstaticvoidmain(String[]args){Strings=shiny()+getShiny();s=s+super.shiny();System.out.println(s);}staticStringgetShiny(){returnshiny();}}结果为:()
A.3
B.12
C.111
D.编译失败
第2题:
A.Theprogramrunsandprints“Hello”
B.Anerrorcausescompilationtofail.
C.Theprogramrunsandprints“Helloworld!”
D.Theprogramrunsbutabortswithanexception.
第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题:
已知有定义:Strings="story",下面()表达式是合法的。
A.s+="books";
B.charC=s[1];
C.intlen=s.length;
D.Strings=s.toLowerCase();
第5题:
下列代码的执行结果是()。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,false
B.true,true
C.false,true
D.false,false
第6题:
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.
第7题:
A.Theprogramrunsandprints“Hello”
B.Anerrorcausescompilationtofail.
C.Theprogramrunsandprints“Helloworld!”
D.Theprogramrunsbutabortswithanexception.
第8题:
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");
第9题:
下列语句输出结果为( )。 public class test { public static void main (String args[]) { Strings1=newString("HOW"); Strings2=newString("How"); System.out.println(!(s1.equals(s2))): } }
A.假
B.真
C.0
D.1
第10题:
下面这段代码会产生( )个String对象。
Strings1="hello";
Strings2=s1.substring(2,3);
Strings3=s1.toString();
Strings4=newStringBuffer(s1).toString();
A、1
B、2
C、3
D、4