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

题目内容 (请给出正确答案)
单选题
public static void main(String[]args){ Integer i=new Integer(1)+new Integer(2); switch(i){ case3:System.out.println("three");break; default:System.out.println("other");break; } } Whatistheresult?()
A

three

B

other

C

Anexceptionisthrownatruntime.

D

Compilationfailsbecauseofanerroronline12.

E

Compilationfailsbecauseofanerroronline13.

F

Compilationfailsbecauseofanerroronline15.


参考答案

参考解析
解析: 暂无解析
更多 “单选题public static void main(String[]args){ Integer i=new Integer(1)+new Integer(2); switch(i){ case3:System.out.println("three");break; default:System.out.println("other");break; } } Whatistheresult?()A threeB otherC Anexceptionisthrownatruntime.D Compilationfailsbecauseofanerroronline12.E Compilationfailsbecauseofanerroronline13.F Compilationfailsbecauseofanerroronline15.” 相关考题
考题 阅读以下说明和Java代码,将应填入(n)处的字句写在对应栏内【说明】编写字符界面的Application程序,接收依次输入的10个整型数据,每个数据一行,将这些数据按升序排序后从系统的标准输出设备输出。【Java代码】import java.iO.*;import java.util.* ;public class compositor{public static void main ( String args[] ){final int NUMBER=10;Vector dataVector=new Vector ();try{BufferedReader br=new BufferedReader ((1) InputStreamReader ( System.in ));System.out.println ("请输入"+NUMBER+"个整数");for (int i=0; i<NUMBER; i++ ){int temp=Integer.parselnt ( br.(2));int low=0, high=i-1, mid=0;while ((3)){System.out.println ( low+","+mid+","+high );(4);if ((( Integer ) dataVectOr.get( mid )) .intValue () ==temp ){data Vector.insertElementAt ( new Integer ( temp ), mid );break;}else if ((( Integer ) dataVector.get ( mid )) .intValue ( ) >temp ){high=mid-1;}else{(5);}}if ( low>high ){dataVector, insertElementAt ( new Integer ( temp ), iow );}}//输出System.out.println ( "\n升序的排序结果为; ");for (int i=0; i<NUMBER; i++ ){System.out.print ( dataVector.get( i ) .toString () +"\t" );}}catch ( NumberFormatException nfe){System.out.println ( nfe.toString ());System.out.println ( "整数格式输入错误。");}catch ( IOException ioe ){System.out.println ( ioe.toString ());}}}

考题 下面程序的输出结果是( )。 public class Sun { public static void main(String args[ ]) { int i = 9; switch (i) { default: System.out.println("default"); case 0: System.out.println("zero"); break; case 1: System.out.println("one"); case 2: System.out.println("two"); } } }A.defaunB.defauh, zeroC.error default clause not definedD.no output displayed

考题 下面程序的输出结果是( )。 public class Sun { public static void main(String args[ ]) { int i = 1; switch (i) { case 0: System.out.println("zero"); break; case 1: System.out.println("one"); case 2; System.out.println("two"); default: System.out.println("default"); } } }A.oneB.one,defaultC.one,two,defaultD.default

考题 设有如下程序: import java.util.*; public class Sun { public static void main(String args[ ]) { int score; String a; Random r=new Random(); score=r.nextInt(4)+5; switch(score) { case 0: a="E"; break; case 1: a="D"; break; case 2: a="C"; break; case 3: a="B"; break; default: a="A"; } System.out.println(A) ; } } 程序运行的结果是( )。A.a="A"B.aa"E" a="A"C.a="E"D.a="C"

考题 ( 28 )请阅读下面程序public class ThreadTest {public static void main ( String args[ ]) throws Exception {int i=0;Hello t = new Hello ();___________;whlle ( true ){System.out.println ( "Good Morning"+i++ ) ;if ( i=2 && t.isAlive ()){System.out.println ( "Main waiting for Hello ! ” );tjoin () ; // 等待 t 运行结束}if ( i==5 ) break :}}}class Hello extends Thread {int i ;public void run ()笼while ( true ){System.out.println ( "Hello"+i++ ) ;if ( i=5 ) break ;}}}为使该程序正确执行,下划线处的语句应是A ) t.sleep ()B ) t.yieldn ()C ) t.interrupt ()D ) t.start ()

考题 下列程序中,实现将封装数据类型Integer和基本数据类型int之间的转换,以及Integer,int类型和String类型之间的转换。请将程序补充完整。程序运行结果如下:123456456public class ex7_1{public static void main(String[]args) {Integer intObj;int n;String s;intObj = new Integer(123);n=intObj.__________;System.out.printin(Integer.toString(n));s=new String("456");intObj=Integer._________;System.out.println(intObj.__________);n=Integer.parseInt(s);System.out.println(Integer.toString(n));}}

考题 请阅读下面程序 public class ThreadTest{ public static void main(String args[])throws Ex- ception{ int i=0; Hello t=new Hello; ; while(true){ System.Out.println("Good Morning"+i++): if(i= =2t.isAlive){ System.out.println("Main waiting for Hel- lo!"); join;//等待t运行结束 } if(i= =5)break;} } } class Hello extends Thread{ int l; public void run{ while(true)( System.Out.println("Hell0"+i++); if(i= =5)break;)))A.t.sleepB.t.yieldC.t.interruptD.t.start

考题 public static void main(String[]args){Integer i=new Integer(1)+new Integer(2);switch(i){case3:System.out.println(three);break;default:System.out.println(other);break;}}Whatistheresult?()A.threeB.otherC.Anexceptionisthrownatruntime.D.Compilationfailsbecauseofanerroronline12.E.Compilationfailsbecauseofanerroronline13.F.Compilationfailsbecauseofanerroronline15.

考题 11.publicstaticvoidmain(String[]args){12.Integeri=uewInteger(1)+newInteger(2);13.switch(i){14.case3:System.out.println(”three”);break;15.default:System.out.println(”other”);break;16.}17.}Whatistheresult?()A.threeB.otherC.Anexceptionisthrownatruntime.D.Compilationfailsbecauseofanerroronline12.E.Compilationfailsbecauseofanerroronline13.F.Compilationfailsbecauseofanerroronline15.

考题 下面程序的输出结果是( )。 public class Sun { public static void main(String args[ ]) { int i = 1; switch (i) { case 0: System.but.println("zero"); break; case 1: System.out.println("one"); case 2: System.out.println("two"); default: System.out.println ("default"); } } }A.oneB.one, defaultC.one, two, defaultD.default

考题 给出下面代码片段: public class Test{ public static void main (String args[ ]){ int m; switch(m) { case 0:System.out.println("case 0"); case 1:System.out.println("case 1"):break; case 2: default:System.out.println("default"); } } } 下列m的( )值将引起"default"的输出。A.1B.2C.4D.0

考题 下面程序段的输出结果是( )。 public class Test{ public static void main(String args[]){ int i=1: switch(i){ case0: System.OUt.println("0"); break; casel: System.out.println("1"); case2: System.OUt.println("2"); break; default: System.out.println("default"); } } }A.01B.12C.10D.21

考题 给出下面代码段: public class Test{ public static void main(String args[] ) { int m; switch(m) { case 0: System.out.println("case 0"); case 1: System.out.println("case 1"); break; case 2: break; default: System.out.println("default"); } } } 下列m的值能引起输出“default”的是( )。A.0B.1C.2D.4

考题 设有如下程序public class test {public static void main(String args[]) {Integer intObj=Integer.valueOf(args[args.length-1]);int i = intObj.intValue();if(args.length >1、System.out.println(i);if(args.length >0)System.out.println(i -1、;elseSystem.out.println(i - 2、;}}运行程序,输入如下命令:java test 2则输出为:A. testB. test -1C. 0D. 1E. 2

考题  class Super {  public Integer getLenght() { return new Integer(4); } }  public class Sub extends Super {  public Long GetLenght() { return new Long(5); }  public static void main(String[] args) { Super sooper = new Super();  Sub sub = new Sub();  System.out.println(  sooper.getLenght().toString() + “,” +  sub.getLenght().toString() ); } }  What is the output?()  A、 4,4B、 4,5C、 5,4D、 5,5E、 Compilation fails.

考题 public class Test {  public static void add3 (Integer i) {  int val = i.intValue();  val += 3;  i = new Integer(val); }  public static void main(String args[]) {  Integer i = new Integer(0);  add3(i);  System.out.println(i.intValue());  }  }   What is the result? () A、 0B、 3C、 Compilation fails.D、 An exception is thrown at runtime.

考题 class Beta {  public static void main(String [] args) {  Integer x = new Integer(6) * 7;  if (x != 42) {  System.out.print("42 ");  } else if (x 〈 new Integer(44-1)) {  System.out.println("less");  } else {  System.out.print("done"); } } }  结果是什么?() A、lessB、42C、doneD、编译失败

考题 11. public static void main(String[] args) {  12. Integer i = uew Integer(1) + new Integer(2);  13. switch(i) {  14. case 3: System.out.println(”three”); break;  15. default: System.out.println(”other”); break;  16. }  17. }  What is the result?() A、 threeB、 otherC、 An exception is thrown at runtime.D、 Compilation fails because of an error on line 12.E、 Compilation fails because of an error on line 13.F、 Compilation fails because of an error on line 15.

考题 public static void main( String[] args ) {  Integer a = new Integer(10);  Integer b = new Integer(10);  Integer c = a;  int d = 10;  double e = 10.0;  }   Which three evaluate to true?()   A、 (a == c)B、 (d == e)C、 (b == d)D、 (a == b)E、 (b == c)F、 (d == 10.0)

考题 public static void main(String[]args){ Integer i=new Integer(1)+new Integer(2); switch(i){ case3:System.out.println("three");break; default:System.out.println("other");break; } } Whatistheresult?()A、threeB、otherC、Anexceptionisthrownatruntime.D、Compilationfailsbecauseofanerroronline12.E、Compilationfailsbecauseofanerroronline13.F、Compilationfailsbecauseofanerroronline15.

考题 public class test {   public static void add3 (Integer i){  int val = i.intValue ( );   val += 3;   i = new Integer (val);    }     public static void main (String args [ ] )  { Integer i = new Integer (0);    add3 (i);   system.out.printIn (i.intValue ( ) );   }    }   What is the result?()A、 Compilation will fail.B、 The program prints “0”.C、 The program prints “3”.D、 Compilation will succeed but an exception will be thrown at line 3.

考题 多选题public static void main( String[] args ) {  Integer a = new Integer(10);  Integer b = new Integer(10);  Integer c = a;  int d = 10;  double e = 10.0;  }   Which three evaluate to true?()A(a == c)B(d == e)C(b == d)D(a == b)E(b == c)F(d == 10.0)

考题 单选题11. public static void main(String[] args) {  12. Integer i = uew Integer(1) + new Integer(2);  13. switch(i) {  14. case 3: System.out.println(”three”); break;  15. default: System.out.println(”other”); break;  16. }  17. }  What is the result?()A  threeB  otherC  An exception is thrown at runtime.D  Compilation fails because of an error on line 12.E  Compilation fails because of an error on line 13.F  Compilation fails because of an error on line 15.

考题 单选题class Super {  public Integer getLenght() { return new Integer(4); } }  public class Sub extends Super {  public Long GetLenght() { return new Long(5); }  public static void main(String[] args) { Super sooper = new Super();  Sub sub = new Sub();  System.out.println(  sooper.getLenght().toString() + “,” +  sub.getLenght().toString() ); } }  What is the output?()A  4,4B  4,5C  5,4D  5,5E  Compilation fails.

考题 单选题public class Test {  public static void add3 (Integer i) {  int val = i.intValue();  val += 3;  i = new Integer(val); }  public static void main(String args[]) {  Integer i = new Integer(0);  add3(i);  System.out.println(i.intValue());  }  }   What is the result? ()A  0B  3C  Compilation fails.D  An exception is thrown at runtime.

考题 单选题public class test {  public static void add3 (Integer i)  int val = i.intValue ( );  val += 3;  i = new Integer (val);  } public static void main (String args [ ] )  {  Integer  i = new Integer (0);  add3 (i);  system.out.printIn (i.intValue ( )  );  } What is the result?()A  Compilation will fail.B  The program prints “0”.C  The program prints “3”.D  Compilation will succeed but an exception will be thrown at line 3.

考题 单选题class Beta {  public static void main(String [] args) {  Integer x = new Integer(6) * 7;  if (x != 42) {  System.out.print("42 ");  } else if (x 〈 new Integer(44-1)) {  System.out.println("less");  } else {  System.out.print("done"); } } }  结果是什么?()A lessB 42C doneD 编译失败