多选题public class MethodOver {   private int x, y;   private float z;   public void setVar(int a, int b, float c){   x = a;   y = b;   z = c;   }   }   Which two overload the setVar method?()Avoid setVar (int a, int b, float c){  x = a;  y = b;  z = c;  }Bpublic void setVar(int a, float c, int b) {  setVar(a, b, c);  }Cpublic void setVar(int a, float c, int b) {  this(a, b, c);  }Dpublic void setVar(int a, float b){  x = a;  z = b;  }Epublic void setVar(int ax, int by, float cz) {  x = ax;  y = by;  z = cz;  }

多选题
public class MethodOver {   private int x, y;   private float z;   public void setVar(int a, int b, float c){   x = a;   y = b;   z = c;   }   }   Which two overload the setVar method?()
A

void setVar (int a, int b, float c){  x = a;  y = b;  z = c;  }

B

public void setVar(int a, float c, int b) {  setVar(a, b, c);  }

C

public void setVar(int a, float c, int b) {  this(a, b, c);  }

D

public void setVar(int a, float b){  x = a;  z = b;  }

E

public void setVar(int ax, int by, float cz) {  x = ax;  y = by;  z = cz;  }


参考解析

解析: 暂无解析

相关考题:

( 31 )有如下程序#include iostreamusing namespace std;Class Base{public:Base(int x=0):valB(x) {coutvalB;}~Base() {coutvalB;}private:int valB;};class Derived:public Base{public:Derived(int x=0,int y=0):Base(x),valD(y){coutvalD;}~Derived() {coutvalD; }private:int valD;};int main(){Derived obj12(2,3);retuen 0;}运行时的输出结果是A ) 2332B ) 2323C ) 3232D ) 3223

有如下程序:includeusing namespace std;Class TestClass{private:int x,y;public:Te 有如下程序: #include<iostream> using namespace std; Class TestClass { private: int x,y; public: TestClass(int i,int j) { x=i; y=j; } void print() { cout<<“print1”<<endl; } void print()const { cout<<”prinA.printlB.print2C.printl print2D.程序编译时出错。

有如下类定义:class Point{public:Point(int xx=0,int yy=0):x(xx),y(yy) { }private:int x,y;};class Circle:public Point{public:Circle(int r):radius(r) { }private:int radius;};派生类Circle中数据成员的个数是( )。A、3B、1C、5D、2

完成下列类的构造函数,初始化语句为______。 include class Test { private: int x,y 完成下列类的构造函数,初始化语句为______。include<iostream.h>class Test{private:int x,y;public:void Test(int initx,int inity){______}void printx( ){cout<<x<<"-"<<y<<"="<<x-y;}};void main( ){Test x(300,200);x.printx( );}

有以下程序:includeusingnamespacestd;definePI3.14classPoint{private: intx,y;pub 有以下程序: #include <iostream> using namespace std; #define PI 3.14 class Point { private: int x,y; public: Point(int a,int b) { x=a; y=b; } int getx() { return x; } int gety() { return y; } }; class Circle : public Point { private: int r; public: Circle(int a,int b,int c):Point(a,b) { r=c; } int getr() { return r; } double area() { return PI*r*r; } }; int main() { Circle c1(5,7,10); cout<<cl.area()<<endl; return 0; } 程序执行后的输出结果是A.314B.157C.78.5D.153.86

有以下程序:include using namespace std;class A{private: int x,y;public: void se 有以下程序: #include <iostream> using namespace std; class A { private: int x,y; public: void set (int i,int j) { x=i; y=j; } int get_y() { return y; } }; class box { private: int length,width; A label; public: void set(int 1,int w, int s,int p) { length=1; width=w; label.set(s,p); } int get_area() { return length*width; } }; int main() { box small; small.set(2,4,1,35); cout<<small.get_area()<<end1; return 0; } 运行后的输出结果是( )。A.8B.4C.35D.70

有以下程序:includeusing namespace std;definePl 3.14Class Point{private:int x,y 有以下程序: #include<iostream> using namespace std; #definePl 3.14 Class Point {private: int x,y; public: Point(int a,intB) {X=a; y:b;} int getx() <return x;} int gety() {return y;}}; class Circle:public Point {priA.314B.157C.78.5D.153.86

若有以下程序:include using namespace std;class Base{private: int a,b;public: Ba 若有以下程序: #include <iostream> using namespace std; class Base { private: int a,b; public: Base(int x, int y) { a=x; b=y; } void show() { cout<<a<<", "<<b<<end1; } }; class Derive : public Base { private: int c, d; public: Derive(int x, int y, int z,int m):Base(x,y) { c=z; d=m; } void show() { cout<<c<<", "<<d<<end1; } }; int main ( ) { Base b(50,50) ,*pb; Derive d(10,20,30,40); pb=d; pb->show {); return 0; }A.10,20B.30,40C.20,30D.50,50

有以下程序:includeusing namespace std;class sample{private:int x;static int y; 有以下程序: #include<iostrearn> using namespace std; class sample { private: int x; static int y; public: sample (int A) ; static void print (sample s); }; sample::sample(int A) { x=a; y+=x; }A.x=10,y=20B.x=20,y=30C.x=30,y=20D.x=30,y=30

若有以下程序:includeusing namespace std;class A{private:int a; public:void seta 若有以下程序: #include<iostream> using namespace std; class A { private: int a; public: void seta(int x) { a=x; } void showa() { cout<<a<<","; } }; class B { private: int b; public: void setb(int x) { b=x; } void showb() { cout<<b<<",”; } }; class C:pUblic A,private B { private: int c; public: void setc(int x,int y,int z) { c=z; seta(x); setb(y); } void showc() { showa(); showb(); cout<<c<<end1; } }; int main() { Cc; c.setc(1,2,3); c.showc(); retrun 0; } 程序执行后的输出结果是A.1,2,3B.1,1,1C.2,2,2D.3,3,3

如下程序执行后的输出结果是【】。include using namespace std; class Base { public: 如下程序执行后的输出结果是【 】。include <iostream>using namespace std;class Base{public:Base(int x,int y){a=x;b=y;}void Show(){cout<<"Base: "<<a<< ',' <<b<<" ";}private:int a,b;};class Derived : public Base{public:Derived(int x, int y, int z) : Base(x,y),c(z) { }void Show(){cout<<"Derived:"<<c<<end1;}private:int c;};int main(){Base b(100,100),*pb;Derived d(10,20,30);pb=b;pb->Show();pb=d;pb->Show();return 0;}

若有以下程序:includeusing namespace std;class A{private:inta;public:voidseta(in 若有以下程序: #include <iostream> using namespace std; class A { private: int a; public: void seta(int x) { a=x; } void showa() { cout<<a<<","; } }; class B { private: int b; public: void setb (int x) { b=x; } void showb() { cout<<b<<","; } }; class C :public A,private B { private: int c; public: void setc(int x, inc y, int z) { c=z; seta (x); setb (y); } void showc() { showa (); showb (); cout<<c<<end1; } }; int main () { C c; c. setc(1,2,3); c.showc(); return 0; } 程序执行后的输出结果是A.1,2,3B.1,1,1C.2,2,2D.3,3,3

若有以下程序:include using namespace std;class Base{private: inta,b;public: Bas 若有以下程序: #include <iostream> using namespace std; class Base { private: int a,b; public: Base(int x, int y) { a=x; b=y; } void disp () { cout<<a<<" "<<b<<end1; } }; class Derived : public Base { private: int c; int d; public: Derived(int x,int y, int z,int m) :Base(x,y) { c=z; d=m; } void disp () { cout<<c<<" "<<d<<end1; } }; int main() { Base b(5,5),*pb; Derived obj(1,2,3,4); pb=obj; pb->disp(); return 0; } 执行程序后的输出结果是( )。A.1,2B.3,4C.2,3D.5,5

若有以下程序:include using namespace std;class A{private:int a;public:void seta 若有以下程序:#include <iostream>using namespace std;class A{private: int a;public: void seta(int x) { a=x; } void showa() { cout<<a<<","; }};class B{private: int b;public: void setb(int x) { b=x; } void showb() { cout<<b<<","; }};class C: public A, private B{private: int c;public: void setc(int x, int y, int z) { c=z; seta(x); setb(y); } void showc() { showa(); showb(); cout<<c<<end1; }};int main(){ C c; c.setc(1,2,3); c.showc(); return 0;}程序执行后的输出结果是( )。A.1,2,3B.1,1,1C.2,2,2D.3,3,3

有以下程序:include include using namespace std;class Y;class X{private 有以下程序: #include <iostream> #include <string> using namespace std; class Y; class X { private: int x; char *strx; public: X(int a, char *str) { x=a; strx=new char[strlen(str)+1]; strcpy(strx,str); } void show(Y ob) ; }; class Y { private: int y; char *stry; public: Y(int b,char *str) { y=b; stry=new char[strlen(str)+1]; strcpy(stry, str); } friend void X: :show(Y ob) ; }; void X: :show(Y ob) { cout<<strx<<", "; cout<<ob, stry<<end1; } int main ( ) { X a(10,"X"); Y b (20, "Y"); a. show(B) ; return 0; } 执行后的输出结果是( )。A.X,YB.a,bC.X,XD.Y,Y

若有以下程序:include using namespace std;define PI 3.14class Point{private: in 若有以下程序: #include <iostream> using namespace std; #define PI 3.14 class Point { private: int x,y; public: Point(int a,int b) { x=a; y=b; } int getx() { return x; } int gety() { return y; } }; class Circle : public Point { private: int r; public: Circle(int a, int b,int c) :Point(a,b) { r=c; } int getr() { return r; } double area() { return PI*r*r; } }; int main() { Circle c1(5,7,10); cout<<c1.area()<<end1; return 0; } 程序执行后的输出结果是( )。A.314B.157C.78.5D.153.86

有下列程序:includeusing namespace std;class TestClass{private:int x,y;public:Te 有下列程序: #include<iostream> using namespace std; class TestClass { private: int x,y; public: TestClass (int i,int j) { x=i; y=j; } void print() { cout<<"printl"<<endl; } voA.print1B.print2C.pfint1 print2D.程序编译时出错

有以下程序:include using namespace std;define PI 3.14class Point{ private:int 有以下程序: #include <iostream> using namespace std; #define PI 3.14 class Point { private: int x,y; public: Point(int a,int b) { x=a; y=b; } int getx() { return x; }A.314B.157C.78.5D.153.86

请找出下列程序中错误之处 ______。 include classA{private: intx1;protected: int 请找出下列程序中错误之处 ______。#include<iostream.h>class A{private:int x1;protected:int x2;public:int x3;};class B:public A{private:int y1;protected:int y2;public:int y3;void disp(){cout<<x1<<y1<<end1:} //Avoid set(int i) {x2=i;} //B};void main() {B bb;bb.x3=10; //Cbb.y3=10; //D}A.AB.BC.CD.D

若有以下程序:include using namespace std;class point{private: int x, y;public: 若有以下程序: #include <iostream> using namespace std; class point { private: int x, y; public: point ( ) { x=0; y=0; } void setpoint(int x1,int y1) { x=x1; y=y1;A.12,12B.5,5C.12,5D.5,12

public class X {  public X aMethod() { return this;}  }  public class Y extends X {  }  Which two methods can be added to the definition of class Y?()A、 public void aMethod() {}B、 private void aMethod() {}C、 public void aMethod(String s) {}D、 private Y aMethod() { return null; }E、 public X aMethod() { return new Y(); }

public class ConstOver {  public ConstOver (int x, int y, int z)  {  }  }   Which two overload the ConstOver constructor?()   A、 ConstOver ( ) { }B、 Protected int ConstOver ( ) { }C、 Private ConstOver (int z, int y, byte x) { }D、 Public Object ConstOver (int x, int y, int z) { }E、 Public void ConstOver (byte x, byte y, byte z) { }

public class MethodOver {   private int x, y;   private float z;   public void setVar(int a, int b, float c){   x = a;   y = b;   z = c;   }   }   Which two overload the setVar method?()A、 void setVar (int a, int b, float c){  x = a;  y = b;  z = c;  }B、 public void setVar(int a, float c, int b) {  setVar(a, b, c);  }C、 public void setVar(int a, float c, int b) {  this(a, b, c);  }D、 public void setVar(int a, float b){  x = a;  z = b;  }E、 public void setVar(int ax, int by, float cz) {  x = ax;  y = by;  z = cz;  }

public abstract class Shape {  private int x;  private int y;  public abstract void draw();  public void setAnchor(int x, int y) {  this.x = x;  this.y = y;  }  }  Which two classes use the Shape class correctly?()A、 public class Circle implements Shape { private int radius; }B、 public abstract class Circle extends Shape { private int radius; }C、 public class Circle extends Shape { private int radius; public void draw(); }D、 public abstract class Circle implements Shape { private int radius; public void draw(); }E、 public class Circle extends Shape { private int radius;public void draw() {/* code here */} }F、 public abstract class Circle implements Shape { private int radius;public void draw() { / code here */ } }

单选题public class SyncTest (  private int x;  private int y;  private synchronized void setX (int i) (x=1;)  private synchronized void setY (int i) (y=1;)  public void setXY(int 1)(set X(i); setY(i);)  public synchronized Boolean check() (return x !=y;)  )  Under which conditions will check () return true when called from a different class?A Check() can never return true.B Check() can return true when setXY is called by multiple threads.C Check() can return true when multiple threads call setX and setY separately.D Check() can only return true if SyncTest is changed to allow x and y to be setseparately.

多选题public abstract class Shape {  private int x;  private int y;  public abstract void draw();  public void setAnchor(int x, int y) {  this.x = x;  this.y = y;  }  }  Which two classes use the Shape class correctly?()Apublic class Circle implements Shape { private int radius; }Bpublic abstract class Circle extends Shape { private int radius; }Cpublic class Circle extends Shape { private int radius; public void draw(); }Dpublic abstract class Circle implements Shape { private int radius; public void draw(); }Epublic class Circle extends Shape { private int radius;public void draw() {/* code here */} }Fpublic abstract class Circle implements Shape { private int radius;public void draw() { / code here */ } }

单选题public class SyncTest {  private int x;  private int y;  private synchronized void setX( int i ) { x = i; }  private synchronized void setY( int i ) { y = i; }  public void setXY( int i ) { setX(i); setY(i); }  public synchronized boolean check() { return x != y; }  }   Under which condition will check return true when called from a different class? ()A check can never return true.B check can return true when setXY is called by multiple threads.C check can return true when multiple threads call setX and setY separately.D check can return true only if SyncTest is changed to allow x and y to be set separately.