one
one three two
one two three
one two three four
four one three two
编译失败
第1题:
class Parent { String one, two; public Parent(String a, String b){ one = a; two = b; } public void print(){ System.out.println(one); } } public class Child extends Parent { public Child(String a, String b){ super(a,b); } public void print(){ System.out.println(one + " to " + two); } public static void main(String arg[]){ Parent p = new Parent("south", "north"); Parent t = new Child("east", "west"); p.print(); t.print(); } } Which of the following is correct?()
第2题:
Which declarations will allow a class to be started as a standalone program?()
第3题:
public class Base { public static final String FOO = “foo”; public static void main(String[] args) { Base b = new Base(); Sub s = new Sub(); System.out.print(Base.FOO); System.out.print(Sub.FOO); System.out.print(b.FOO); System.out.print(s.FOO); System.out.print(((Base)s).FOO); } } class Sub extends Base {public static final String FOO=bar;} What is the result?()
第4题:
import java.util.*; public class PQ { public static void main(String[] args) { PriorityQueue
第5题:
现有: import java.util.*; class ScanStuff { public static void main (String [] args) { String S= "x,yy,123"; Scanner sc = new Scanner (s); while (sc.hasNext()) System.out.print (sc.next() +" "); } } 结果是什么?()
第6题:
import java.util.*; public class WrappedString { private String s; public WrappedString(String s) { this.s = s; } public static void main(String[] args) { HashSet
第7题:
apple:apple
carrot:apple
apple:banana
banana:apple
carrot:carrot
carrot:banana
第8题:
public void main(String args[])
public void static main(String args[])
public static main(String[] argv)
final public static void main(String [] array)
public static void main(String args[])
第9题:
1
3
123
321
The code rims with no output.
第10题:
Compilation fails.
aAaA aAa AAaa AaA
AAaa AaA aAa aAaA
AaA AAaa aAaA aAa
aAa AaA aAaA AAaa
An exception is thrown at runtime.
第11题:
x yy
x,yy,123
x yy 123
x,yy
编译失败
运行的时候有异常抛出
第12题:
foofoofoofoofoo
foobarfoobarbar
foobarfoofoofoo
foobarfoobarfoo
barbarbarbarbar
foofoofoobarbar
foofoofoobarfoo
第13题:
现有: class Tree { private static String tree = "tree "; String getTree () { return tree; } } class Elm extends Tree { private static String tree = "elm "; public static void main (String [] args) { new Elm() .go (new Tree()) ; } } void go (Tree t) { String s = t.getTree () +Elm.tree + tree + (new Elm() .getTree ()) ; System.out.println (s) ;} 结果为:()
第14题:
1. import java.util.*; 2. class AddStuff { 3. public static void main(String [] args) { 4. TreeSet〈String〉 s = new TreeSet〈String〉(); 5. s.add("one"); 6. s.add("two"); 7. // insert code here 8. for(String s2 : sorted) 9. System.out.print(s2 + " "); 10. } 11. } 和四个代码片段: s1. SortedSet sorted = s.tailSet(s.first()); s2. SortedSet〈String〉 sorted = s.tailSet(s.first()); s3. SortedSet sorted = (SortedSet)s.tailSet(s.first()); s4. SortedSet sorted = (SortedSet〈String〉)s.tailSet(s.first()); 分别插入到第7行,哪项可以编译?()
第15题:
import java.util.*; public class LetterASort { public static void main(String[] args) { ArrayList
第16题:
现有: import java.util.*; class AddStuff2 { public static void main(String [] args) { TreeSet
第17题:
import java.util.*; class ScanStuff { public static void main(String [] args) { String s = "x,yy,123"; Scanner sc = new Scanner(s); while (sc.hasNext()) System.out.print(sc.next() + " "); } } 结果是什么?()
第18题:
0
1
2
3
4
Compilation fails.
An exception is thrown at runtime.
第19题:
elm elm elm elm
tree elm elm elm
tree elm tree elm
编译失败
第20题:
s1
s2
s2 和 s3
s2 和 s4
第21题:
elm elm elm elm
tree elm elm elm
tree elm elm tree
tree elm tree elm
第22题:
Cause error during compilation.
south east
south to north east to west
south to north east
south east to west
第23题:
x yy
x,yy
x yy 123
x,yy,123
第24题:
one
one three two
one two three
one two three four
four one three two
编译失败