网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
现有: 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.print(x2==xl); system..ut.print(x2==x3); system..ut.print(x2.equals(x3)); } } 结果为:() A、编译失败B、falsefalsetruetruetruetrueC、truetruetruetruetruetrueD、falsefalsetruetruetruefalseE、truefalsetruefalsefalsetrueF、运行时异常被抛出” 相关考题
考题
现有:publicclassTester{publicstaticvoidmain(String[]args){intx-5;Integerxl=x;Integerx2=x;intx3=newInteger(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.falsefalsetruetruetruetrueC.truetruetruetruetruetrueD.falsefalsetruetruetruefalseE.truefalsetruefalsefalsetrueF.运行时异常被抛出
考题
interface A{int x = 0;}class B{int x =1;}class C extends B implements A {public void pX(){System.out.println(x);}public static void main(String[] args) {new C().pX();}}
考题
若有以下程序:include using namespaces std;class A{public: A (){} A (int i) {x1=
若有以下程序: #include <iostream> using namespaces std; class A { public: A (){} A (int i) { x1=i; } void dispa() { cout<<"xl="<<xl<<" , "; } private: int x1; }; class B : public A { public: B (){} B (int i):A(i+10) { x2=i; } void dispb() { dispa (); cout <<"x2="<<x2<<end1; } private: int x2; }; int main () { B b(2); b.dispb (): return 0; } 程序运行后的输出结果是( )。A.x1=10,x2=2B.x1=12,x2=10C.x1=12,x2=2D.x1=2,x2=2
考题
下列程序段执行后,x5的结果是______。 public class ex42 { public static void main(String[] args) { int xl = 8; int x2 = 12; int x3=7; int x4; int x5; x4 = x1 > x2 ? x1 : x2+ x1; x5 = x4 > x3 ? x4 : x3; System.out.println(x5); } }A.11B.20C.10D.12
考题
以下程序的运行结果为: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. 3B. 4C.5D.6E.7
考题
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、编译失败
考题
现有: 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、 2B、 3C、 4D、编译失败
考题
程序: class TestApp{ public static void main (String[] args){ int x=6; if (xl) System. out. println("xl"); else if (x5) System. out .println("x5"); else if (x10) System. out. println("xA、x5B、xlC、x10D、x29
考题
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)
考题
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、 mainB、 编译失败C、 代码运行,但没有输出D、 main java.lang.RuntimeException:exception
考题
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、42B、doneC、dot =D、编译失败
考题
现有: 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、1B、2C、3D、编译失败
考题
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、doneB、编译失败C、运行的时候有异常抛出D、lessE、42
考题
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 TestApp{ public static void main (String[] args){ int x=6; if (xl) System. out. println("xl"); else if (x5) System. out .println("x5"); else if (x10) System. out. println("xSystem. out .println( "x29"); else System. out.println(“以上都不是”); } } 上述程序运行后的结果是哪项?() A、x5B、xlC、x10D、x29
考题
现有: 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、 mainB、 编译失败C、 代码运行,但没有输出D、 main java.lang.RuntimeException: exception
考题
现有: 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、numberB、runtimeC、forty numberD、编译失败
考题
单选题现有: 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
falsefalsetruetruetruetrueC
truetruetruetruetruetrueD
falsefalsetruetruetruefalseE
truefalsetruefalsefalsetrueF
运行时异常被抛出
考题
多选题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)
考题
单选题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
doneB
编译失败C
运行的时候有异常抛出D
lessE
42
考题
单选题程序: class TestApp{ public static void main (String[] args){ int x=6; if (xl) System. out. println("xl"); else if (x5) System. out .println("x5"); else if (xSystem. out .println( "xA
x5B
xlC
x10D
x29
考题
单选题程序: class TestApp{ public static void main (String[] args){ int x=6; if (xl) System. out. println("xl"); else if (x5) System. out .println("x5"); else if (x10) System. out. println("x
A
x5B
xlC
x10D
x29
考题
单选题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
编译失败
考题
单选题现有: 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
mainB
编译失败C
代码运行,但没有输出D
main java.lang.RuntimeException: exception
考题
单选题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
42B
doneC
dot =D
编译失败
热门标签
最新试卷