System.out.println(Math.sqrt(-4D)); What is the result?() A、 –2B、 NaNC、 InfinityD、 Compilation fails.E、 An exception is thrown at runtime.
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.
相关考题:
下面程序段的输出结果是( )。 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 (x>y) System.out.println("x>y"); else if (x==y) System.out.println("x=y"); else System.out.println("x<y"); } }A.x>yB.x=yC.x<yD.编译错误
( 21 )阅读下列代码public class Test2005{public static void main(String args[]){System.out.println((32) ? 4 : 5) ;}}其运行结果是A ) 2B ) 3C ) 4D ) 5
阅读下列程序public class VariableUse{public static void main (String[] args) {int a;if (a==8) {int b=9;System.out.println( “ a = ” +a);System.out.println( “ b = ” +b);}System.out.println( “ a = ” +a);System.out.println( “ b = ” +b);}}该程序在编译时的结果是A )变量 a 未赋值B )第二个 System.out.println( “ b = ” +b) 语句中,变量 b 作用域有错C )第二个 System.out.println( “ a = ” +a) 语句中,变量 a 作用域有错D )第一个 System.out.println( “ b = ” +b) 语句中,变量 b 作用域有错
下面程序段的输出结果是( )。 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.
try{if((newObject))(.equals((newObject()))){System.out.println(equal”);}else{System.out.println(notequal”);}}catch(Exceptione){System.out.println(exception”);}Whatistheresult?() A.equalB.notequalC.exceptionD.Compilationfails.
try{intx=0;inty=5/x;}catch(Exceptione){System.out.println(Exception”);}catch(ArithmeticExceptionae){System.out.println(ArithmeticException”);}System.out.println(finished”);Whatistheresult?() A.finishedB.ExceptionC.Compilationfails.D.ArithmeticException
publicvoidfoo(booleana,booleanb){if(a){System.out.println(A”);}elseif(ab){System.out.println(AB”);}else{17.if(!b){System.out.println(notB”);}else{System.out.println(ELSE”);}}}Whatiscorrect?()A.Ifaistrueandbistruethentheoutputis“AB”.B.Ifaistrueandbisfalsethentheoutputis“notB”.C.Ifaisfalseandbistruethentheoutputis“ELSE”.D.Ifaisfalseandbisfalsethentheoutputis“ELSE”.
booleanbool=true;if(bool=false){System.out.println(“a”);}elseif(bool){System.out.println(“c”);}elseif(!bool){System.out.println(“c”);}else{System.out.println(“d”);}Whatistheresult?() A.aB.bC.cD.dE.Compilationfails.
下面程序段的输出结果是( )。 publicclassTest{ publicstaticvoidmain(Stringargs[]){ intx,y; x=(int)Math.sqrt(5)/2+(int)Math.random()*5/2; Y=(int)Math.sqrt(3)/2+(int)Math.random()*3/2; if(x>y) System.out.println9"x>y"); elseif(x==y) System.out.println("x=y"); else System.out.println("x<y"); } }A.x>yB.x=yC.x<yD.编译错误
下面程序段的输出结果是______。 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(x>y) System.out.println("x>y"); else if(x==y) System.out.println("x=y"); else System.out.println("x<y"); } }A.x>yB.x=yC.x<yD.编译错误
研究下面的Java代码: switch (x) { case 1: System.out.println(1); case 2: case 3: System.out.println(3); case 4: System.out.println(4); } 当x=2时,运行结果是()。 A、没有输出任何结果B、输出结果为3C、输出结果是3和4D、输出结果是1、3和4
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.
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.
单选题研究下面的Java代码: switch (x) { case 1: System.out.println(1); case 2: case 3: System.out.println(3); case 4: System.out.println(4); } 当x=2时,运行结果是()。A没有输出任何结果B输出结果为3C输出结果是3和4D输出结果是1、3和4
单选题JavaScript中,显示81的平方根的正确方法是?()Adocument.write(math.sqrt(81))Bdocument.write(Math.sqrt(81))Cdocument.write(Math.sqrt”81”)Ddocument.write(Math.sqrt”81”)
单选题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.
单选题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.
单选题System.out.println(Math.sqrt(-4D)); What is the result?()A –2B NaNC InfinityD 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