10.publicclassClassA{11.publicvoidmethodA(){12.ClassBclassB=newClassB();13.classB.getValue();14.}15.}And:20.classClassB{21.publicClassCclassC;22.23.publicStringgetValue(){24.returnclassC.getValue();25.}26.}And:30.classClassC{31.publicStringvalue;32.33.publicStringgetValue(){34.value=ClassB”;35.returnvalue;36.}37.}Given:ClassAa=newClassA();a.methodA();Whatistheresult?()
10.publicclassClassA{
11.publicvoidmethodA(){
12.ClassBclassB=newClassB();
13.classB.getValue();
14.}
15.}
And:
20.classClassB{
21.publicClassCclassC;
22.
23.publicStringgetValue(){
24.returnclassC.getValue();
25.}
26.}
And:
30.classClassC{
31.publicStringvalue;
32.
33.publicStringgetValue(){
34.value=ClassB”;
35.returnvalue;
36.}
37.}
Given:
ClassAa=newClassA();
a.methodA();
Whatistheresult?()
相关考题:
public class ClassA{public int getValue(){int value=0;boolean setting=true;String title=Hello;if(value||(setting title==Hello)){return 1;}if(value==1title.equals(Hello)){return 2;}}}And:ClassA a=new ClassA();a.getValue();What is the result?()A.1B.2C.Compilation fails.D.The code runs with no output.E.An exception is thrown at runtime.
publicclassClassA{publicintgetValue(){intvalue=0;booleansetting=true;Stringtitle=”Hello”;(value||(settingtitle==Hello”)){return1;}(value==1title.equals(”Hello”)){return2;}}}And:ClassAa=newClassA();a.getValue();Whatistheresult?()A.1B.2C.Compilationfails.D.Thecoderunswithnooutput.E.Anexceptionisthrownatruntime.
publicclassClassA{11.publicvoidcount(inti){12.count(++i);13.}14.}And:20.ClassAa=newClassA();21.a.count(3);Whichexceptionorerrorshouldbethrownbythevirtualmachine?() A.StackOverflowErrorB.NullPointerExceptionC.NumberFormatExceptionD.IllegalArgumentExceptionE.ExceptionlnlnitializerError
下面程序段的输出结果为 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.y; } }A.x=10B.x=20C.x=6D.编译不通过
下面程序段的输出结果为( )。 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=10B.x=20C.x=6D.编译不通过
下面程序段的输出结果为( )。 package test; public class ClassA { int x=20: static int y=6; public static void main(String args[]) { ClassB b=new ClassB; go(10); System.out.println("x="+b.x); } } class ClassB { int X; void go(int y) { ClassA a=new ClassA; x=a.Y ; } }A.x=10B.x=20C.x=6D.编译不通过
3下面程序段的输出结果为( )。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.y; }}A.x=10B.x=20C.x=6D.编译不通过
有以下源程序: 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.y; } } 上述源程序文件的运行结果为( )。A.x=10B.x=20C.x=6D.编译不通过
下面程序段的输出结果为 package test; public class 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 ClassB { int x; void go(int y) { ClassA a=new ClassA(); x=a.y; } }A.x=10B.x-20C.x=6D.编译不通过