网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)
单选题
2. public class Foo implements Runnable (  3. public void run (Thread t) {  4. system.out.printIn(“Running.”);  5. }  6. public static void main (String[] args)  {  7. new thread (new Foo()).start(); 8. )  9. )   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 6 causes the compilation to fail.

E

 “Running” is printed and the program exits.


参考答案

参考解析
解析: 暂无解析
更多 “单选题2. public class Foo implements Runnable (  3. public void run (Thread t) {  4. system.out.printIn(“Running.”);  5. }  6. public static void main (String[] args)  {  7. new thread (new Foo()).start(); 8. )  9. )   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 6 causes the compilation to fail.E  “Running” is printed and the program exits.” 相关考题
考题 单选题public class TestString 1 {  public static void main(String[] args) {  String str = “420”;  str += 42;  System.out.print(str);  }  }  What is the output?()A  42B  420C  462D  42042E  Compilation fails.F  An exception is thrown at runtime.

考题 单选题Float pi = new Float(3.14f);  if(pi3) {  System.out.print(”pi is bigger than 3. “);  }  else {  System.out.print(”pi is not bigger than 3. “); }  finally {  System.out.println(”Have a nice day.”);  }  What is the result?()A  Compilation fails.B  pi is bigger than 3.C  An exception occurs at runtime.D  pi is bigger than 3. Have a nice day.E  pi is not bigger than 3. Have a nice day.

考题 单选题1. public class X (  2. public object m ()  {  3. object o = new float (3.14F);  4. object [] oa = new object [1];  5. oa[0]= o;  6. o = null;  7. return oa[0];  8. }  9. }   When is the float object created in line 3, eligible for garbage collection?()A  Just after line 5B  Just after line 6C  Just after line 7 (that is, as the method returns)D  Never in this method.

考题 单选题public class Test {  public static void main(String [] args) {  System.out.println(args.length  4   args[4].equals(“-d”));  }  }   If the program is invoked using the command line: java Test One Two Three –d   What is the result?()A  trueB  falseC  Compilation fails.D  An exception is thrown at runtime.

考题 单选题public class SyncTest {  private int x;   private int y;   public synchronized void setX (int i) (x=1;)   public synchronized void setY (int i) (y=1;)   public synchronized void setXY(int 1)(set X(i); setY(i);)   public synchronized Boolean check() (return x !=y;)   }   Under which conditions will check () return true when called from a different class?A  Check() can never return true.B  Check() can return true when setXY is called by multiple threads.C  Check() can return true when multiple threads call setX and setY separately.D  Check() can only return true if SyncTest is changed to allow x and y to be set separately.

考题 单选题84. try {  85. ResourceConnection con = resourceFactory.getConnection();  86. Results r = con.query(”GET INFO FROM CUSTOMER”);  87. info = r.getData();  88. con.close();  89. } catch (ResourceException re) {  90. errorLog.write(re.getMessage());  91. }  92. return info;  Which is true if a ResourceException is thrown on line 86?()A  Line 92 will not execute.B  The connection will not be retrieved in line 85.C  The resource connection will not be closed on line 88.D  The enclosing method will throw an exception to its caller.