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

题目内容 (请给出正确答案)

下面程序段的输出结果为 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=10

B.x-20

C.x=6

D.编译不通过


参考答案

更多 “ 下面程序段的输出结果为 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.编译不通过 ” 相关考题
考题 下列程序的输出结果是非曲直【 】。includeclass base{ int x, y;public: base(int i, 下列程序的输出结果是非曲直【 】。include<iostream, h>class base{int x, y;public:base(int i, int j){x=i; y=j;}virtual int add(){return x+ y;}};class three: public base{int z;public:three(int i, int j, int k) :base(i, j){z=k; }int add() { return (base:: add()+z); }};void main(){three * q=new three(lO,20,30);cout<<q->add()<<end1;}

考题 下面程序段的输出结果是( )。 public class Test { public static void main(String args[ ]){ int x,y; x=(int)Math.sqrt(5)/2+(int)Math.random()*5/2; y=(int)Math.sqrt(3)/2+(int)Math.random()*3/2; if (x>y) System.out.println("x>y"); else if (x==y) System.out.println("x=y"); else System.out.println("x<y"); } }A.x>yB.x=yC.x<yD.编译错误

考题 下面代码段的输出结果为( )。 public class Test { public static void main(String sss[]) { int i=0xFFFFFFFl; int j=~i; } }A.0B.1C.14D.-15

考题 下面程序的输出为( )。 public class Test { public static void main (String args[]) { int x,y; x=1; y=2; System.out.println("The output is"+x+y); } }A.The output is xyB.The output is 3C.The output is 12D.The output is x=1 y=2

考题 执行下面程序段,屏幕上将输出( )。 public class Test { private int x=10,y=20; public Test (int x,int y) { System.out.println (x+this.x); System.out.println (y+y); } public static void main (String[] args) { Testt= new Test(30,50); } }A.无输出B.20 40C.40 100D.40 70

考题 下面程序段的输出结果是( )。 public class Test { public static void main (String[] args) { for ( int a=0;a<10;a++) { if (a==5) break; System.out.println(A); } } }A.01234B.6789C.012346789D.5

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

考题 在如下源代码文件Test.java中, 哪个是正确的类定义?() A.public class test { public int x = 0; public test(int x) { this.x = x; } }B.public class Test{ public int x=0; public Test(int x) { this.x = x; } }C.public class Test extends T1, T2 { public int x = 0; public Test (int x) { this.x = x; } }D.public class

考题 下面程序的输出结果是什么? class C1{ static int j=0; public void method(int a){ j++; } } class Test extends C1{ public int method(){ return j++; } public void result(){ method(j); System.out.println(j+method()); } public static void main(String args[]){ new TeA.0B.1C.2D.3

考题 下面程序段的输出结果是( )。 public class Test{ public static void main(String args[]){ int X,y; x=(int)Math.sqrt(5)/2+(int)Math.random*5/2; y=(int)Math.sqrt(3)/2+(int)Math.random*3/2; if(xv) System.OUt.println("xy"); elseif(x= =y) System.out.println("x=Y"); else System.out.println("xy"): } }A.xyB.x=YC.xyD.编译错误

考题 下面程序段的输出结果是( )。 public class Test t public static void main(String[] args) { int x=0; for (int i=1;i<=4;i++) { x=4; for(int j=1;j<=3; j++) { x=3; for(int k=1; k<=2; k++) x=x+6; } } System. out. println (x); } }A.36B.48C.144D.15

考题 下面程序段的输出结果为 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.编译不通过

考题 下面程序片段的执行中,说法正确的是( )。 public class Test { public static void main (String args[]) { byte y=20; int i=y; int x=100; y=x; System.out.println(y); } }A.输出y的值为100B.第4行错误C.输出y的值为20D.第6行错误

考题 下面程序的输出结果是【】。 include using namespace std; class A {int a,b; public:A 下面程序的输出结果是【 】。include <iostream>using namespace std;class A{int a, b;public:A(){a = b = 0;}A(int aa, int bb ) : a(aA) , b(bB){cout <<"a="<<a<<","<<"b="<<b<<",";}~A(){cout<<"D";};int main ( ){A x, y(2, 3);return 0;}

考题 执行下面程序,显示的结果为( )。 public class Test { public static void main (String args[]) { Test t=newTest(); System.out.println (Loverload ("2","3")); } int overload (intx,int y) {return x+y;} String overload (String x,Stnng y){return x+y;} }A.2B.3C.5D.23

考题 下面程序执行的结果是【 】 include using namespace std; class A{ public: static in 下面程序执行的结果是【 】include<iostream>using namespace std;class A{public:static int x;A(inty){cout<<x+y;}};int A::x=2;void main(){A a(5);}

考题 下面程序段的输出结果为( )。 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.编译不通过

考题 有如下程序: include class x { protected: int a; public:x(){ a=1;} }; class x 有如下程序: #include <iostream.h> class x { protected: int a; public: x() { a=1; } }; class x1 : virtual public x { public: x1() { a+=1; cout<<a; } }; class x2 : virtual public x { public: x2() { a+=2; cout<<a; } }; class y : public xl,public x2 { public: y() { cout<<a<<end1; } }; int main() { y obj; return O; } 该程序运行后的输出结果是( )。A.1B.123C.242D.244

考题 下面程序段的输出结果是______。 public class Test{ public static void main(String args[ ]){ int x,y; x=(int)Math.sqrt(5/2)+(int)Math.random( )*5/2; y=(int)Math.sqrt(3/2)+(int)Math.random( )*3/2; if(x>y) System.out.println("x>y"); else if(x==y) System.out.println("x=y"); else System.out.println("x<y"); } }A.x>yB.x=yC.x<yD.编译错误

考题 下面程序段的输出结果为 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; } }A.x=10B.x=20C.x=6D.编译不通过

考题 下面的例子中using System;class A{public static int X;static A(){X=B.Y+1;}}class B{public static int Y=A.X+1;static B(){}static void Main(){Console.WriteLine("X={0},Y={1}",A.X,B.Y);}}产生的输出结果是什么?

考题 下面程序输出的结果是( )。 include using namespace std; class A{ 下面程序输出的结果是( )。 #include<iostream> using namespace std; class A{ int X; public: A(int x):x(++x){} ~A(){cout<<x;} }; class B:public A{ int y; public: B(int y):A(y),y(y){} ~B(){cout<<y;}; }; void main(){ B b(3); }A.34B.43C.33D.44

考题 有以下源程序: 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.编译不通过

考题 阅读下面的程序public class Test {public static void main(String[] args) {for(int x = 0 ; x A.跳出循环,无输出B.0121C.01D.0123

考题 在下列源代码文件Test.java中,哪个选项是正确的类定义? ( )A.public class test { public int x=0; public test(int x) { this.x=x; } }B.public class Test { public int x=0; public Test(int x) { this.x=x; } }C.public class Test extends Ti,T2 { public int x=0; public Test(int x) { this.x=x; } }D.protected class Test extends T2 { public int x=0; public Test(int x) { this.x=x; } }

考题 以下程序的输出结果为:public class test {public static void main(String args[]) {int m=0;for ( int k=0;k A. 000B. 012C.123D.111

考题 以下程序调试结果为:public class Test {int m=5;public void some(int x) {m=x;}public static void main(String args []) {new Demo().some(7);}}class Demo extends Test {int m=8;public void some(int x) {super.some(x);System.out.println(m);}}A.5B.8C.7D.无任何输出E.编译错误

考题 下列程序的输出结果是______。 include class base { int x,y; public: base(int i,i 下列程序的输出结果是______。include<iostream.h>class base{int x,y;public:base(int i,int j){x=i;y=j;}virtual int add( ){return x+y;}};class three:public base{int z;public:three(int i,int j,int k):base(i,j){z=k;)int add( ){return(base::add( )+z);}};void main( ){three*q=new three(10,20,30);cout<<q->add( )<<endl;}