public class Foo implements Runnable ( public void run (Thread t) { system.out.printIn(“Running.”); } public static void main (String[] args) { new thread (new Foo()).start(); } ) What is the result?()
A、 An exception is thrown.
B、 The program exists without printing anything.
C、 An error at line 1 causes compilation to fail.
D、 An error at line 2 causes the compilation to fail.
E、 “Running” is printed and the program exits.
相关问题推荐
-
Which method will complete this class?()
A、 public int compareTo(Object o){/* more code here */}
B、 public int compareTo(Score other){/* more code here */}
C、 public int compare(Score s1, Score s2){/* more code here */}
D、 public int compare(Object o1, Object o2){/* more code here */}
-
Which capability exists only in java.io.BufferedWriter?()
A、Closing an open stream.
B、Flushing an open stream.
C、Writing to an open stream.
D、Writing a line separator to an open stream.
-
class A { public A() { System.out.println(“hello from a”); } } class B extends A { public B () { System.out.println(“hello from b”); super(); } } public class Test { public static void main(String args[]) { A a = new B(); } } What is the result when main is executed?()
A、 Compilation fails.
B、 hello from a
C、 hello from b
D、 hello from b hello from a
E、 hello from a hello from b
-
Use the operators ">", which statements are true? ()
A0000 0100 0000 0000 0000 0000 0000 0000<<5 gives 1000 0000 0000 0000 0000 0000 0000 0000
B0000 0100 0000 0000 0000 0000 0000 0000<<5 gives 1111 1100 0000 0000 0000 0000 0000 0000
C1100 0000 0000 0000 0000 0000 0000 0000>>5 gives 1111 1110 0000 0000 0000 0000 0000 0000
D1100 0000 0000 0000 0000 0000 0000 0000>>5 gives 0000 0110 0000 0000 0000 0000 0000 0000
-
Write a line of code that declares a variable named layout of type LayoutManager and initializes it with a new object, which when used with a container can lay out components in a rectangular grid of equal-sized rectangles, 3 components wide and 2 components high.()