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
[主观题]若有如下程序:public class Test {public static void main (String[] args) {int x=20;if (x>10) System.out.print(x-=5);if (x>5) System.out.print(x--);}}则程序运行后的输出结果是[ ]。
[单选题]有如下类定义: class Test { int x_,y_; public: Test ():a_(0) ,b_(0) {} Test(int a,int b=0) :a_(a),b_(b){} }; 若执行语句 Test x(2) ,y[3],*z[4]; 则Test类的构造函数被调用的次数是( )。A.2次B.3次C.4次D.5次
[单选题]有如下类说明: class TestClass{ int x; public: TestClass(int n){x=n;} }; class TestClass1:public TestClass{ int y; public: TestClass1(int a,int b); }; 在构造函数TestClass1的下列定义中,正确的是( )。A.TestClass1::TestClass1 (int a,int b):x(a),y(b){}B.TestClass1::TestClass1 (
[单选题]有如下类定义:class Test{public:Test(){ a = 0; c = 0;} // ①int f(int a)const{this->a = a;} // ②static int g(){return a;} // ③void h(intB. . {Test::b = b;}; // ④private:int a;static int b;const int c;};int Test::b = 0;在标注号码的行中,能被正确编译的是A. . ①B. . ②C. . ③D.
[单选题]有如下类定义: class Test { public: Test(){a=0;c=0;} //① int f(int a)const {this->a=a;} //② static int g(){return a;} //③ void h(int b){Test::b=b;}; //④ private: int a; static int b; const int c; }; int Test::b=0; 在标注号码的行中,能被正确编译的是A.①B.②C.③D.④
[单选题]有如下类定义: class Test { public: Test(){a=0;C=0;t //① int f(int A) const{this->a=a;} //② static int g( ){return a;} //③ void h(int B) {Test::b=b;}; //④ private: int a; static int b; const int c; }; int Test::b=0: 在标注号码的行中,能被正确编译的是A.①B.②C.③D.④
[单选题]有如下类定义: class Test { public: Test(){a=0;c=0} //① int f(int a)const{this->a=a;} //② static int g(){return a;} //③ void h(int b){Test::b;}; //④ private: int a; static int b; const int C; }; int Test::b=0; 在标注号码的行中,能被正确编译的是( )。A.①B.②C.③D.④
[单选题]执行如下程序: public class Test { public static void main (String args[]) { int x=1,a=0,b=0; switch (x) { case 0: b++; case 1: a++; case 2: a++;b++; } System.out.println("a=" +a ",b=" +b); } } 该程序的输出结果是( )。A.a=2,b=1B.a=1,b=1C.a=1,b=0D.a=2,b=2
[单选题]下面程序段的输出结果为 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.pr
[单选题]下面程序段的输出结果为 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.p