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

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

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

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

D.a=100 b=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}

若下面程序运行时输出结果为1,A,10.1 2,B,3.5 include using namespace std; int mai 若下面程序运行时输出结果为1,A,10.12,B,3.5include <iostream>using namespace std;int main(){void test(int, char, doubie【 】);test(1, 'A', 10.1 );test(2, 'B');return 0;}void test(int a, char b, double c){cout<<a<<','<<b<<','<<c<<endl;}

使用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;}

下列程序的运行结果是【 】。 include class test { private: int num; public: tes 下列程序的运行结果是【 】。include <iostream. h>class test{private:int num;public:test()int TEST() {return num+100;}~test()};test::test(){num=0;}test::~test(){cout<<"Destructor is active"<<endl;}void main(){test x[3]cout<<x[1]. TEST()<<endl;}

下列程序的运行结果是______。 include class test { private: int hum; public: tes 下列程序的运行结果是______。include<iostream.h>class test{private:int hum;public:test( );int TEST( ){return num+100;)~test( );};test::test( ){num=0;)test::~test( ){cout<<"Destructor is active"<<endl;)void main( ){test x[3];cout<<x[1].TEST( )<<endl;}

下列程序段的输出结果是includevoid fun(int * x,int * y){cout 下列程序段的输出结果是 #include<iostream.h> void fun(int * x,int * y) { cout << * X << * y; *X=3; *y=4; } void main() { int x=1,y=2; fun(y,x); cout << X << y<<endl; {A.2143B.1212C.1234D.2112

有如下程序: #includeiostream usingnamespacestd; classTest( public: Test( ){} Test(constTest8Lt){cout1;} }; Testfun(Test&u){Testt=U;returnt;} intmain( ){Testx,y;x=fun(y);return0;} 运行这个程序的输出结果是( )。A.无输出B.1C.1lD.111

如下程序编译时发生错误,错误的原因是show函数实现语句错误,则正确的语句应该为______。include<iostream.h>class test{private:int hum;public:test(int);void show( );};test::test(int n){num=n;}test::show( ){cout<<num<<endl;}void main( ){test T(10):T.show( );}

阅读以下说明和Java程序,填写程序中的空(1)~(6),将解答写入答题纸的对应栏内。【说明】以下Java代码实现一个简单绘图工具,绘制不同形状以及不同颜色的图形。部分接口、类及其关系如图5-1所示。【Java代码】interface?DrawCircle?{? //绘制圆形 public(1) ;}class?RedCircle?implements?DrawCircle?{? ?//绘制红色圆形???????public?void?drawCircle(int?radius,intx,?int?y)??{????????????System.out.println("Drawing?Circle[red,radius:"?+?radius?+",x:"?+?x?+?",y:"?+y+?"]");???????}}class?GreenCircle?implements?DrawCircle?{????//绘制绿色圆形??????public?void?drawCircle(int?radius,?int?x,int?y)?{???????????System.out.println("Drawing?Circle[green,radius:"?+radius+",x:?"?+x+?",y:?"?+y+?"]");??????}}abstract?class?Shape?{????//形状? protected? ? (2)???;? ? public?Shape(DrawCircle?drawCircle)?{? ?this.drawCircle=?drawCircle;? ? ? public?abstract?void?draw();}class?Circle?extends?Shape?{? //圆形? ?private?int?x,y,radius;? public?Circle(int?x,int?y,intradius,DrawCircle?drawCircle)?{? ?(3)???;? this.x?=?x;? ? ? this.y?=?y;? ?this.radius?=radius;? }? ? ?public?void?draw()?{? ? drawCircle.? ?(4)? ?;? ? ? }}public?class?DrawCircleMain?{? public?static?void?main(String[]?args)?{? Shape?redCircle=new?Circle(?100,100,10,? (5) );//绘制红色圆形? Shape?greenCircle=new?Circle(200,200,10,(6) );//绘制绿色圆形? ?redCircle.draw(); greenCircle.draw();? ?}}

以下标识符哪些是合法的?哪些是Java的关键字? miles, Test, a++, --a, 4#R, $4, #44, apps,class, public, int, x, y, min value, 成绩, radius,最大值max。