单项选择题
// Point X
public class foo {
public static void main(String[] args) throws Exception {
jave.io.PrintWriter out = new jave.io.PrintWriter(
new jave.io.OutputStreamWriter(System.out), true);
out.println(“Hello”);
}
}
Which statement at Point X on line 1 is required to allow this code to compile?()
A. No statement is required.
B. import jave.io.*;
C. include java.io.*;
D. import jave.io.PrintWriter;
E. include java.io.PrintWriter;
相关考题
-
多项选择题
ArraryList a = new ArrayList(); a.add(“Alpha”); a.add(“Bravo”): a.add(“Charlie”); a.add(“Delta”); Iterator iter = a.iterator(); Which two, added at line 17, print the names in the ArrayList in alphabetical order?()
A. for (int i=0; i< a.size(); i++) System.out.println(a.get(i)));
B. for (int i=0; i< a.size(); i++) System.out.println(a[i]);
C. while( iter.hasNext() ) System.out.println(iter.next()) ;
D. for (int i=0, i< a.size(); i++) System.out.println(iter[i]);
E. for (int i=0; i< a.size(); i++) System.out.println(iter.get(i)); -
单项选择题
Whatcancauseathreadtobecomenon-runnable?()
A. Exiting from a synchronized block.
B. Calling the wait method on an object.
C. Calling the notify method on an object.
D. Calling the notifyAll method on an object. -
单项选择题
public class A extends Thread { A() { setDaemon(true); } public void run() { (new B()).start(); try { Thread.sleep(60000); } catch (InterruptedException x) {} System.out.println(“A done”); } class B extends Thread { public void run() { try { Thread.sleep(60000); } catch (InterruptedException x) {} System.out.println(“B done”); } } public static void main(String[] args) { (new A()).start(); } } What is the result?()
A. A done
B. B done
C. A done B done
D. B done A done
E. There is no exception that the application will print anything.
F. The application outputs “A done” and “B done”, in no guaranteed order.
