下面程序段的输出结果为( )。 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("a="+Obj2.a+"b="+Obj2.b); } }A.a=100b=200 a=12 b=45B.a=12 b=45 a=100b=200C.a=12 b=200 a=100b=45D.a=100b=45 a=12 b=200

下面程序段的输出结果为( )。 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("a="+Obj2.a+"b="+Obj2.b); } }

A.a=100b=200 a=12 b=45

B.a=12 b=45 a=100b=200

C.a=12 b=200 a=100b=45

D.a=100b=45 a=12 b=200


相关考题:

若下面程序运行时输出结果为1, A, 10.12, B, 3.5请将程序补充完整 。#includeusing namespace std;int main(){void test(int, char,double 【 8 】 );test(1,'A',10.1);test(2,'B');return 0;}void test(int a, char b, doubleC .{cout}

下面程序段的输出结果为 public class Test { int a,b; Test() { a=100; b=200; } Test(int x,int y) { a=x; b=y; } public static void main(String args[]) { Test bjl=new Test(12,45); System.out.println("a="+objl.a+" b="+Objl.B); Test Obj2=new Test(); System.out.println("a="+Obj2.a+" b="+Obj2.B); } }A.a=100 b=200 a=12 b=45B.a=12 b=45 a=100 b=200C.a=12 b=200 a=100 b=45D.a=100 b=45 a=12 b=200

使用VC6打开老考生文件夹下的工程test5_1,此工程包含一个源程序文件test5_1.cpp,但该程序运行有问题,请改正程序中的错误,使程序的输出结果如下:x=3 y=5 z=08源程序文件test5_1.cpp清单如下:include<iostream.h>static int x=5;int z=0;int *add(int x,int y){cout<<"X="<<X<<"y="<<y<<" Z="<<z<<endl;z=z+x+y;/********found*********/return z;/********found*********/};void main(){int y=5;int x=3;/*********found********/cout<<(add(X,y))<<endl;}

下面程序段的输出结果为 public class Test { int a,b; Test() { a=100; b=200; } Test(int x,int y) { a=x; b=y; } public static void main(String args[]) { Test Obj1=new Test(12,45); System.out.println(”a=”+Obj 1.a+” b=”+Obj 1.b); Test Obj2=new Test(); System.out.println(”a=”+Obj 2.a+” b=”+Obj 2.b); } }A.a=100 b=200 a=12 b=45B.a=12 b=45 a=100 b=200C.a=12 b=200 a=100 b=45D.a=100 b=45 a=12 b=200

使用VC6打开考生文件夹下的工程test30_1,此工程包含一个源程序文件test30_1.cpp,但该程序运行有问题,请改正程序中的错误,使该程序的输出结果为:Previous=9,Next=11源程序文件test30_1.cpp清单如下:include <iostream.h>/***************** found *****************/void prevnext (int,int ,int);int main ( ){int x=10,y,z;prevnext (x,y,z);cout << "Previous=" << y << ", Next=" << z<<end1;return 0;}/***************** found *****************/void prevnext (int x, int prev, int next){/***************** found *****************/prev=x--;next=++x;}

下列程序段的输出结果是______。 public class Test{ int a,b; Test( ){ a=100; b=200; } Test(int x,int y){ a=X; b=y; } public static void main(String args[ ]){ Test Obj1=new Test(12,45); System.out.println("a="+Obj1.a+"b="+Obj1.B); Test Obj2=new Test( ); System.out.println("a="+Obj1.a+"b="+Obj1.B); } }A.a=100 b=200 a=12 b=45B.a=12 b=45 a=100 b=200C.a=12 b=200 a=100 b=45D.a=100 b=45 a=12 b=200

下面程序段的输出结果为( )。 public class Test { int a,b; Test { a=100; b=200: } Test(int X,int y) { a=x: b=y; } public static void main(String args[]) { Test bjl=new Test(12,45); System.OUt.println("a="+Objl.a+"b="+Objl. b); Test Obj2=new Test; System.out.println("fl="+Obj2.a+"b="+Obj2. b); } }A.a=100 b=200 a=12 b=45B.a=12 b=45a=100 b=200C.a=12 b=200 a=100 b=45D.a=100 b=45 a=12 b=200

3下面程序段的输出结果为( )。public class Test{ int a, b; Test() { a=100; b=200; } Test(int x, int y) { a=x; b=y; } public static void main(String args[]) { Test Obj 1 = new Test(12,45 ); System.out.println("a="+Obja+" b="+Objb); Test Obj2 = new Test(); System.out.println("a="+Obja+" b="+Objb); }}A.a=100 b=200 a=12 b=45B.a=12 b=45 a=100 b=200C.a=12 b=200 a=100 b=45D.a=100 b=45 a=12 b=200

下面程序段的输出结果为 public class Test { int a, b; Test() { a=100; b=200; } Test(int x,int y) { a=x; b=y; } public static void main(String args[]) { Test Obj1=new Test(12,45); System.out.println("a=+Obj1.a+" b="+Obj1.B) ; Test Obj2=new Test(); System.out.println("="+Obja+" b="+ObjB) ; } }A.a=100 b=200 a=12 b=45B.a=12 b=45 a=100 b=200C.a=12 b=200 a=100 b=45D.a=100 b=45 a=12 b=200