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

题目内容 (请给出正确答案)
单选题
System.out.println(Math.sqrt(-4D));  What is the result?()
A

 –2

B

 NaN

C

 Infinity

D

 Compilation fails.

E

 An exception is thrown at runtime.


参考答案

参考解析
解析: 暂无解析
更多 “单选题System.out.println(Math.sqrt(-4D));  What is the result?()A  –2B  NaNC  InfinityD  Compilation fails.E  An exception is thrown at runtime.” 相关考题
考题 下面程序段的输出结果是( )。 public class Test{ public static void main(String args[]){ int X,y; x=(int)Math.sqrt(5)/2+(int)Math.random*5/2; y=(int)Math.sqrt(3)/2+(int)Math.random*3/2; if(xv) System.OUt.println("xy"); elseif(x= =y) System.out.println("x=Y"); else System.out.println("xy"): } }A.xyB.x=YC.xyD.编译错误

考题 System.out.println(Math.sqrt(-4D));Whatistheresult?() A.–2B.NaNC.InfinityD.Compilationfails.E.Anexceptionisthrownatruntime.

考题 int i = 1,j = 10;  do{  if (ij) {  continue;  }  j--;  } while (++i 6);  System.out.println(“i = “ +i+” and j = “+j);  What is the result?()  A、 i = 6 and j = 5B、 i = 5 and j = 5C、 i = 6 and j = 4D、 i = 5 and j = 6E、 i = 6 and j = 6

考题 class MyThread extends Thread {  public void run() { System.out.println(“AAA”); }  public void run(Runnable r) { System.out.println(“BBB”); }  public static void main(String[] args) {  new Thread(new MyThread()).start();  }  }   What is the result?()  A、 AAAB、 BBBC、 Compilation fails.D、 The code runs with no output.

考题 int i = 0, j = 5;  tp;   for (;;) {  i++;  for(;;) {  if (i --j) {  break tp;  break tp;  }  }  System.out.println(“i=” +i “,j =”+j); } What is the result?()  A、 i = 1, j = 0B、 i = 1, j = 4C、 i = 3, j = 4D、 i = 3, j = 0E、 Compilation fails.

考题 public static void main(String[] args) {  String str = “null‟;  if (str == null) {  System.out.println(”null”);  } else (str.length() == 0) {  System.out.println(”zero”);  } else {  System.out.println(”some”);  }  }  What is the result?()A、 nullB、 zeroC、 someD、 Compilation fails.E、 An exception is thrown at runtime.

考题 Given:   11. String test = "This is a test";   12. String[] tokens = test.split("/s");   13. System.out.println(tokens.length);   What is the result?()A、 An exception is thrown at runtime.B、 1C、 4D、 Compilation fails.E、 0

考题 boolean bool = true; if(bool = false) { System.out.println(“a”); } else if (bool) { System.out.println(“c”); } else if (!bool) { System.out.println(“c”); } else { System.out.println(“d”); } What is the result?()  A、 aB、 bC、 cD、 dE、 Compilation fails.

考题 int i = 0;  while (true) { if(i==4) {  break;  }  ++i;  }  System.out.println(“i=”+i);  What is the result?()  A、 i = 0B、 i = 3C、 i = 4D、 i = 5E、 Compilation fails.

考题 public class Test {  public static void aMethod() throws Exception {  try {  throw new Exception(); } finally {  System.out.println(“finally”);  }  }  public static void main(String args[]) {  try {  aMethod();  } catch (Exception e) {  System.out.println(“exception”);  }  System.out.println(“finished”);  }  }  What is the result?()  A、 finallyB、 exception finishedC、 finally exception finishedD、 Compilation fails.

考题 try {  if ((new Object))(.equals((new Object()))) {  System.out.println(“equal”);  }else{  System.out.println(“not equal”);  }  }catch (Exception e) {  System.out.println(“exception”);  }   What is the result? () A、 equalB、 not equalC、 exceptionD、 Compilation fails.

考题 public void testIfA(){ if(testIfB("True")){ System.out.println("True"); }else{ System.out.println("Nottrue"); } } public Boolean testIfB(Stringstr){ return Boolean.valueOf(str); } What is the result when method testIfA is invoked?()A、TrueB、NottrueC、Anexceptionisthrownatruntime.D、Compilationfailsbecauseofanerroratline12.E、Compilationfailsbecauseofanerroratline19.

考题 System.out.println(Math.sqrt(-4D));  What is the result?()  A、 –2B、 NaNC、 InfinityD、 Compilation fails.E、 An exception is thrown at runtime.

考题 String a = null;  a.concat(“abc”);  a.concat(“def”);  System.out.println(a);   What is the result?()  A、 abcB、 nullC、 abcdefD、 Compilation fails.E、 The code runs with no output.F、 An exception is thrown at runtime.

考题 单选题public class Test {  public static void aMethod() throws Exception {  try {  throw new Exception(); } finally {  System.out.println(“finally”);  }  }  public static void main(String args[]) {  try {  aMethod();  } catch (Exception e) {  System.out.println(“exception”);  }  System.out.println(“finished”);  }  }  What is the result?()A  finallyB  exception finishedC  finally exception finishedD  Compilation fails.

考题 单选题int i = 0;  while (true) { if(i==4) {  break;  }  ++i;  }  System.out.println(“i=”+i);  What is the result?()A  i = 0B  i = 3C  i = 4D  i = 5E  Compilation fails.

考题 单选题boolean bool = true; if(bool = false) { System.out.println(“a”); } else if (bool) { System.out.println(“c”); } else if (!bool) { System.out.println(“c”); } else { System.out.println(“d”); } What is the result?()A  aB  bC  cD  dE  Compilation fails.

考题 单选题int i = 1,j = 10;  do {  if(ij) {  break;  } j--;  } while (++i 5);  System.out.println(“i =” +i+” and j = “+j); What is the result?()A  i = 6 and j = 5B  i = 5 and j = 5C  i = 6 and j = 4D  i = 5 and j = 6E  i = 6 and j = 6

考题 单选题for (int i =0; i  4; i +=2) {  System.out.print(i + “”);  }  System.out.println(i);  What is the result?()A  0 2 4B  0 2 4 5C  0 1 2 3 4D  Compilation fails.E  An exception is thrown at runtime.

考题 单选题public void testIfA(){ if(testIfB("True")){ System.out.println("True"); }else{ System.out.println("Nottrue"); } } public Boolean testIfB(Stringstr){ return Boolean.valueOf(str); } What is the result when method testIfA is invoked?()A TrueB NottrueC Anexceptionisthrownatruntime.D Compilationfailsbecauseofanerroratline12.E Compilationfailsbecauseofanerroratline19.

考题 单选题public static void main(String[] args) {  try {  args=null;  args[0] = “test”;  System.out.println(args[0]);  } catch (Exception ex) {  System.out.println(”Exception”);  } catch (NullPointerException npe) {  System.out.println(”NullPointerException”);  }  }  What is the result?()A  testB  ExceptionC  Compilation fails.D  NullPointerException

考题 单选题public static void main(String[] args) {  String str = “null‟;  if (str == null) {  System.out.println(”null”);  } else (str.length() == 0) {  System.out.println(”zero”);  } else {  System.out.println(”some”);  }  }  What is the result?()A  nullB  zeroC  someD  Compilation fails.E  An exception is thrown at runtime.

考题 单选题try {  int x = 0;  int y = 5 / x;  } catch (Exception e) {  System.out.println(“Exception”);  } catch (ArithmeticException ae) {  System.out.println(“Arithmetic Exception”);  }  System.out.println(“finished”);  What is the result?()A  finishedB  ExceptionC  Compilation fails.D  Arithmetic Exception

考题 单选题try {  if ((new Object))(.equals((new Object()))) {  System.out.println(“equal”);  }else{  System.out.println(“not equal”);  }  }catch (Exception e) {  System.out.println(“exception”);  }   What is the result? ()A  equalB  not equalC  exceptionD  Compilation fails.

考题 单选题public static void main(String[]args){ String str="null"; if(str==null){ System.out.println("null"); }else(str.length()==0){ System.out.println("zero"); }else{ System.out.println("some"); } } What is the result?()A nullB zeroC someD Compilationfails.E Anexceptionisthrownatruntime.

考题 单选题Given:   11. String test = "This is a test";   12. String[] tokens = test.split("/s");   13. System.out.println(tokens.length);   What is the result?()A  An exception is thrown at runtime.B  1C  4D  Compilation fails.E  0

考题 单选题public class Test {  public static void main(String Args[]) {  int i =1, j = 0;  switch(i) {  case 2: j +=6;  case 4: j +=1;  default: j +=2;  case 0: j +=4;  }  System.out.println(“j =” +j);  }  }  What is the result? ()A  0B  2C  4D  6E  9F  13