易搜题 > 资格证大类 > 计算机编程 > 问题详情
问题详情

 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.

未找到的试题在搜索页框底部可快速提交,在会员中心"提交的题"查看可解决状态。 收藏该题
查看答案

相关问题推荐

  • import java.util.*;  public class PQ {  public static void main(String[] args) {  PriorityQueue pq = new PriorityQueue();  pq.add(”carrot”); pq.add(”apple”);  pq.add(”banana”);  System.out.println(pq.poll() +”:” + pq.peek()); }  }  What is the result?() 

    A、 apple:apple

    B、 carrot:apple

    C、 apple:banana

    D、 banana:apple

    E、 carrot:carrot

    F、 carrot:banana

  • public class Foo {   public static void main (String args) {   int i = 1;   int j = i++;   if ((i>++j) && (i++ ==j)) {   i +=j;   }   }   }   What is the final value of i?()  

    A、 1

    B、 2

    C、 3

    D、 4

    E、 5

  • Which statement is true?()

    A、 If only one thread is blocked in the wait method of an object, and another thread executes the modify on that same object, then the first thread immediately resumes execution.

    B、 If a thread is blocked in the wait method of an object, and another thread executes the notify method on the same object, it is still possible that the first thread might never resume execution.

    C、 If a thread is blocked in the wait method of an object, and another thread executes the notify method on the same object, then the first thread definitely resumes execution as a direct and sole  consequence of the notify call.

    D、 If two threads are blocked in the wait method of one object, and another thread executes the notify method on the same object, then the first thread that executed the wait call first definitely resumes execution as a direct and sole consequence of the notify call.

  • Which constructs a DataOutputStream?()

    A、 New dataOutputStream(“out.txt”);

    B、 New dataOutputStream(new file(“out.txt”));

    C、 New dataOutputStream(new writer(“out.txt”));

    D、 New dataOutputStream(new FileWriter(“out.txt”));

    E、 New dataOutputStream(new OutputStream(“out.txt”));

    F、 New dataOutputStream(new FileOutputStream(“out.txt”));

  • class Super {  public int i = 0;  public Super(String text) {  i = 1; }  }  public class Sub extends Super {  public Sub(String text) {  i = 2;  }   public static void main(String args[]) {  Sub sub = new Sub(“Hello”);  System.out.println(sub.i);  }  }  What is the result?()  

    A、 0

    B、 1

    C、 2

    D、 Compilation fails.

联系客服 会员中心
TOP