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

题目内容 (请给出正确答案)
单选题
import java.io.IOException;  public class ExceptionTest(  public static void main (String[]args)  try (  methodA();  ) catch (IOException e)  (  system.out.printIn(“Caught IOException”);  ) catch (Exception e)   (  system.out.printIn(“Caught Exception”);  )  )  public void methodA ()   {  throw new IOException ();  }   What is the result?()
A

 The code will not compile.

B

 The output is caught exception.

C

 The output is caught IOException.

D

 The program executes normally without printing a message.


参考答案

参考解析
解析: 暂无解析
更多 “单选题import java.io.IOException;  public class ExceptionTest(  public static void main (String[]args)  try (  methodA();  ) catch (IOException e)  (  system.out.printIn(“Caught IOException”);  ) catch (Exception e)   (  system.out.printIn(“Caught Exception”);  )  )  public void methodA ()   {  throw new IOException ();  }   What is the result?()A  The code will not compile.B  The output is caught exception.C  The output is caught IOException.D  The program executes normally without printing a message.” 相关考题
考题 多选题public class Transfers {  public static void main(String[] args) throws Exception {  Record r1 = new Record();  Record r2 = new Record();  doTransfer(r1, r2, 5);  doTransfer(r2, r1, 2);  doTransfer(r1, r2, 1);  // print the result  System.out.println(”rl = “ + r1.get() +“, r2=” + r2.get());  }  private static void doTransfer(  final Record a, final Record b, final int amount) {  Thread t = new Thread() {  public void run() {  new Clerk().transfer(a, b, amount);  }  };  t.start();  }  }  class Clerk {  public synchronized void transfer(Record a, Record b, int amount){  synchronized (a) {  synchronized (b) {  a.add(-amount);  b.add(amount);  }  }  }  }  class Record {  int num=10;  public int get() { return num; }  public void add(int n) { num = num + n; }  }  If Transfers.main() is run, which three are true?()AThe output may be “r1 = 6, r2 = 14”.BThe output may be “r1 = 5, r2 = 15”.CThe output may be “r1 = 8, r2 = 12”.DThe code may run (and complete) with no output.EThe code may deadlock (without completing) with no output.FM IllegalStateException or InterruptedException may be thrown at runtime.

考题 多选题public class ConstOver {  public ConstOver (int x, int y, int z)  {  }  }   Which two overload the ConstOver constructor?()AConstOver ( ) { }BProtected int ConstOver ( ) { }CPrivate ConstOver (int z, int y, byte x) { }DPublic Object ConstOver (int x, int y, int z) { }EPublic void ConstOver (byte x, byte y, byte z) { }

考题 多选题Which two code fragments will execute the method doStuff() in a separate thread?()Anew Thread() { public void run() { doStuff(); } }Bnew Thread() { public void start() { doStuff(); } }Cnew Thread() { public void start() { doStuff(); } } .run();Dnew Thread() { public void run() { doStuff(); } } .start();Enew Thread(new Runnable() { public void run() { doStuff(); } } ).run();Fnew Thread(new Runnable() { public void run() { doStuff(); } }).start();

考题 单选题int x=0;  int y 10;  do {  y--;  ++x;  } while (x  5);  System.out.print(x + “,“ + y);  What is the result?()A  5,6B  5,5C  6,5D  6,6

考题 多选题Which statements about Java code security are true?()AThe bytecode verifier loads all classes needed for the execution of a program.BExecuting code is performed by the runtime interpreter.CAt runtime the bytecodes are loaded, checked and run in an interpreter.DThe class loader adds security by separating the namespaces for the classes of the local file system from those imported from network sources.