niusouti.com

现有:  public class Tester {  public static void main (String[] args)  {      intx-5;  Integer xl=x;  Integer x2=x;     int x3=new Integer(5);  system..ut.print(x1.equals(x));      system..ut.print(xl==x);  system..ut.print(x2.equals(xl));      system..ut.

题目

现有:  public class Tester {  public static void main (String[] args)  {      intx-5;  Integer xl=x;  Integer x2=x;     int x3=new Integer(5);  system..ut.print(x1.equals(x));      system..ut.print(xl==x);  system..ut.print(x2.equals(xl));      system..ut.print(x2==xl);      system..ut.print(x2==x3);  system..ut.print(x2.equals(x3));         }      }      结果为:()     

  • A、编译失败
  • B、falsefalsetruetruetruetrue
  • C、truetruetruetruetruetrue
  • D、falsefalsetruetruetruefalse
  • E、truefalsetruefalsefalsetrue
  • F、运行时异常被抛出

相似考题
更多“现有:  public class Tester {  public static void main (String[] args)  {      intx-5;  Integer xl=x;  Integer x2=x;     int x3=new Integer(5);  system..ut.print(x1.equals(x));      system..ut.print(xl==x);  system..ut.print(x2.equals(xl));      system..ut.p”相关问题
  • 第1题:

    以下程序的运行结果为:public class A {static int k=3;public static void main(String[] args) {int k=4;A x1=new A();x1.k++;A x2=new A();x2.k++;k++;System.out.println(x1.k);}}

    A. 3

    B. 4

    C.5

    D.6

    E.7


    正确答案:C

  • 第2题:

    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、less
    • B、42
    • C、done
    • D、编译失败

    正确答案:A

  • 第3题:

    程序: class TestApp{ public static void main (String[] args){ int x=6; if (x>l) System. out. println("x>l"); else if (x>5) System. out .println("x>5"); else if (x<10) System. out. println("x

    • A、x>5
    • B、x>l
    • C、x<10
    • D、x<29

    正确答案:B

  • 第4题:

    class ThreadExcept implements Runnable {   public void run() { throw new RuntimeException("exception "); }   public static void main(String [] args) {   new Thread(new ThreadExcept()).start();   try {   int x = Integer.parseInt(args[0]);   Thread.sleep(x);   System.out.print("main ");    } catch (Exception e) { }      }  }   和命令行:  java ThreadExcept 1000    哪一个是结果?()  

    • A、 main
    • B、 编译失败
    • C、 代码运行,但没有输出
    • D、 main java.lang.RuntimeException:exception

    正确答案:D

  • 第5题:

    现有:  class Top  {  static int x=l;  public Top (inty)  {  x*=3;  }      }  class Middle extends Top {      public Middle()  {x+=1;  )  public  static void main (String  []  args)  {      Middle m = new Middle();      System. out .println (x);      }     }      结果为:()     

    • A、1
    • B、2
    • C、3
    • D、编译失败

    正确答案:D

  • 第6题:

    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.

    正确答案:B

  • 第7题:

    现有:   class ThreadExcept implements Runnable {   public void run() { throw new RuntimeException("exception "); }  public static void main(String [] args) {   new Thread(new ThreadExcept()).start();   try {   int x = Integer.parseInt(args[0]);   Thread.sleep(x);   System.out.print("main ");    } catch (Exception e) { }      }   }   和命令行:  java ThreadExcept 1000    哪一个是结果?() 

    • A、 main
    • B、 编译失败
    • C、 代码运行,但没有输出
    • D、 main java.lang.RuntimeException: exception

    正确答案:D

  • 第8题:

    单选题
    现有:  public class Tester {  public static void main (String[] args)  {      intx-5;  Integer xl=x;  Integer x2=x;     int x3=new Integer(5);  system..ut.print(x1.equals(x));      system..ut.print(xl==x);  system..ut.print(x2.equals(xl));      system..ut.print(x2==xl);      system..ut.print(x2==x3);  system..ut.print(x2.equals(x3));         }      }      结果为:()
    A

    编译失败

    B

    falsefalsetruetruetruetrue

    C

    truetruetruetruetruetrue

    D

    falsefalsetruetruetruefalse

    E

    truefalsetruefalsefalsetrue

    F

    运行时异常被抛出


    正确答案: D
    解析: 暂无解析

  • 第9题:

    单选题
    class Beta{   public static void main(String[] args){   Integer x=new Integer(6)*7;   if(x!=42){   System.out.print(“42”);   } else if(xSystem.out.println(“less”);   }else{   System.out.print(“done”);   }}}   结果是什么?()
    A

    done

    B

    编译失败

    C

    运行的时候有异常抛出

    D

    less

    E

    42


    正确答案: B
    解析: 暂无解析

  • 第10题:

    单选题
    程序: class TestApp{ public static void main (String[] args){ int x=6; if (x>l) System. out. println("x>l"); else if (x>5) System. out .println("x>5"); else if (x<10) System. out. println("x
    A

    x>5

    B

    x>l

    C

    x<10

    D

    x<29


    正确答案: C
    解析: 暂无解析

  • 第11题:

    单选题
    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

    less

    B

    42

    C

    done

    D

    编译失败


    正确答案: C
    解析: 暂无解析

  • 第12题:

    单选题
    class Beta {   public static void main(String [] args) {   Integer x = new Integer(6) * 7;   if (x != 42) {   System.out.print("42 ");   } else if (x.equals(42)) {   System.out.print("dot = ");   } else {   System.out.print("done");   } } }   结果为:()
    A

    42

    B

    done

    C

    dot =

    D

    编译失败


    正确答案: D
    解析: 暂无解析

  • 第13题:

    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、 0
    • B、 3
    • C、 Compilation fails.
    • D、 An exception is thrown at runtime.

    正确答案:A

  • 第14题:

    现有:  class Top  {     static int X=l;  public Top()  {  x*=3; }     }  class Middle extends Top  {      public  Middle()    {x+=l;  }  public static void main(String  []  args)  {     Middle m=new Middle();    System.out.println (x);    }     }  结果是什么?()    

    • A、  2
    • B、  3
    • C、  4
    • D、编译失败

    正确答案:C

  • 第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)

    正确答案:A,B,F

  • 第16题:

    class Beta {   public static void main(String [] args) {   Integer x = new Integer(6) * 7;   if (x != 42) {   System.out.print("42 ");   } else if (x.equals(42)) {   System.out.print("dot = ");   } else {   System.out.print("done");   } } }   结果为:()  

    • A、42
    • B、done
    • C、dot =
    • D、编译失败

    正确答案:C

  • 第17题:

    class Beta{   public static void main(String[] args){   Integer x=new Integer(6)*7;   if(x!=42){   System.out.print(“42”);   } else if(xSystem.out.println(“less”);   }else{   System.out.print(“done”);   }}}   结果是什么?()  

    • A、done
    • B、编译失败
    • C、运行的时候有异常抛出
    • D、less
    • E、42

    正确答案:D

  • 第18题:

    程序:  class   TestApp{  public  static  void main (String[]  args){     int x=6;     if (x>l)  System. out. println("x>l");     else if (x>5)  System. out .println("x>5");     else if (x<10)  System. out. println("xSystem. out .println( "x<29");     else  System. out.println(“以上都不是”);     }     }  上述程序运行后的结果是哪项?()     

    • A、x>5
    • B、x>l
    • C、x<10
    • D、x<29

    正确答案:B

  • 第19题:

    现有:  class Number{  public static void main(String  []  aras)  {      try  {  System.out.print (Integer.parselnt ("forty"));      } catch (RuntimeException r)  {      System.out.print ("runtime");  } catch  (NumberFormatException e)  {      system..ut.print("number");      }      }      }  结果是什么?()     

    • A、number
    • B、runtime
    • C、forty number
    • D、编译失败

    正确答案:D

  • 第20题:

    多选题
    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)


    正确答案: B,D
    解析: 暂无解析

  • 第21题:

    单选题
    程序:  class   TestApp{  public  static  void main (String[]  args){     int x=6;     if (x>l)  System. out. println("x>l");     else if (x>5)  System. out .println("x>5");     else if (xSystem. out .println( "x
    A

    x>5

    B

    x>l

    C

    x<10

    D

    x<29


    正确答案: C
    解析: 暂无解析

  • 第22题:

    单选题
    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.


    正确答案: C
    解析: 暂无解析

  • 第23题:

    单选题
    现有:   class ThreadExcept implements Runnable {   public void run() { throw new RuntimeException("exception "); }   public static void main(String [] args) {   new Thread(new ThreadExcept()).start();   try {   int x = Integer.parseInt(args[0]);   Thread.sleep(x);   System.out.print("main ");  } catch (Exception e) { }  }   }   和命令行:  java ThreadExcept 1000   哪一个是结果?()
    A

     main

    B

     编译失败

    C

     代码运行,但没有输出

    D

     main java.lang.RuntimeException: exception


    正确答案: B
    解析: 暂无解析