[单选题]

下面程序段的输出结果为( )。 packagetest; publicclassClassA { intx=20; staticinty=6; publicstaticvoidmain(Stringargs[]) { ClassBb=newClassB(); b.go(10); System.out.println("x="+b.x); } } classClassB { intX; voidgo(inty) { ClassAa=newClassA(); X=a.y; } }

A.x=10

B.x=20

C.x=6

D.编译不通过

参考答案与解析:

相关试题

分析下面的Java程序段输出结果为()。

[单选题]分析下面的Java程序段输出结果为()。A . Caught in main()B . Caught in main()nothingC . nothingD . 没有任何输出

  • 查看答案
  • 下面程序段的输出结果为()。pubUCClassTeS{public stati

    [单选题]下面程序段的输出结果为( )。 pubUCClassTeS { public static voidmain(StringargS[]) { booleaha,b,c; a=(3<5); b=(a==tme); System.Out.phntln("a="+a+"b="+b); c=(b==false); SyStem.out.println("b="+b+"C="+c); } }A.a=tme b=falSeB.a=true b=false b=true c=false b=t

  • 查看答案
  • 下面程序段的输出结果为package test;public class A {

    [单选题]下面程序段的输出结果为 package test; public class A { int x=20; static int y=6; public static void main(String args[]) { Class B b=new Class B(); b.go(10); System.out.println(”x=”+b.x); } } class Class B { int x; void go(int y) { ClassA a=new ClassA(); x=a.y; }

  • 查看答案
  • 下面程序段的输出结果为()。publicclass Test{int a,b;T

    [单选题]下面程序段的输出结果为( )。 publicclass Test { int a,b; Test() { a=100; b=200; } Test(intx,inty) { a=X; b=y; } publicstaticvoidmain(Stringargs[]) { TestObj1=newTest(12,45); System.out.println("a="+Obj1.a+" b="+Obj1.b); TestObj2=newTest(); System.out.println(

  • 查看答案
  • 下面程序段的输出结果为package test;public class Cla

    [单选题]下面程序段的输出结果为 package test; public class ClassA { int x=20; static int y=6; public static void main(String args[]) { ClassB b=new ClassB(); b.go(10); System.out.println("x="+b.x); } } class ClassB { int x; void go(int y) { ClassA a=new ClassA(); x=a.

  • 查看答案
  • 下面程序段的输出结果为public class Test{public stat

    [单选题]下面程序段的输出结果为 public class Test { public static void main(String args[]) { boolean a,b,c; a=(3<5); b=(a==true); System.out.println("a="+a+"b="+B); c=(b==false); System.out.println("b="+b+"c="+C); } }A.a=true b=false b=true c=falseB.a=true b=fal

  • 查看答案
  • 下面程序段的输出结果为public class Test{public stat

    [单选题]下面程序段的输出结果为 public class Test { public static void main(String args[]) { boolean a,b,c; a=(3<5); b=(a==true); System.out.println(”a=”+a+”b=+b) ; c=(b==false); System.out.printhln(”b=”+b+”c=”+c) ; } }A.a=true b=false b=true c=falseB.a=true b=false

  • 查看答案
  • 下面程序段的输出结果为public class MyClass{public s

    [单选题]下面程序段的输出结果为 public class MyClass { public static void main(String args[]) { String s="Helto! How are you?"; System.out.println(s.lastlndexOf("o",16)); } }A.16B.oC.uD.17

  • 查看答案
  • 执行下面的程序段,输出结果为______。public class Q{publ

    [主观题]执行下面的程序段,输出结果为______。public class Q{public static void main(String argvr)){int anar[]=new int[5];System.out.println(anar[0]);}}

  • 查看答案
  • 下面程序段的输出结果为______。Print "10£«20=",Print

    [单选题]下面程序段的输出结果为______。 Print "10+20=", Print 10+20 Print "20+20="; Print 20+20A.10+20=30 20+20=40B.10+20= 30 20+20= 40C.10+20 20+20D.10+20=30 20+20= 40

  • 查看答案
  • 下面程序段的输出结果为()。packagetest;publicclassCla