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

题目内容 (请给出正确答案)
多选题
class A {  protected int method1(int a, int b) { return 0; }  }  Which two are valid in a class that extends class A?()
A

public int method1(int a, int b) { return 0; }

B

private int method1(int a, int b) { return 0; }

C

private int method1(int a, long b) { return 0; }

D

public short method1(int a, int b) { return 0: }

E

static protected int method1(int a, int b) { return 0; }


参考答案

参考解析
解析: 暂无解析
更多 “多选题class A {  protected int method1(int a, int b) { return 0; }  }  Which two are valid in a class that extends class A?()Apublic int method1(int a, int b) { return 0; }Bprivate int method1(int a, int b) { return 0; }Cprivate int method1(int a, long b) { return 0; }Dpublic short method1(int a, int b) { return 0: }Estatic protected int method1(int a, int b) { return 0; }” 相关考题
考题 有如下类声明: class Base{ protected: int amount; public: Base(int n=0):araount(n){ } int getAmount( )const{retum amount;} }; class Derived:public Base{ protected; int value; public: Derived(int m,int n):value(n1),Base(n){ } int getData( )const{return value+amount;} }; 已知x是一个Derived对象,则下列表达式中正确的是A.x.value+x.getAmount( )B.x.getData( )-x.getAmount( )C.x.getData( )-x.amountD.x.value+x.amount

考题 有如下程序:includeusing namespace std;class Base{int x;public:Base(int n=0):x(n 有如下程序: #include<iostream> using namespace std; class Base{ int x; public: Base(int n=0):x(n){cout<<n;} int getX( )const{return x;} }; class Derived:public Base{ int y; public: Derived(int m,int n):y(m),Base(n){tout<<m;} Derived(int m):y(m){cout<<m;} }; int main( ){ Derived dl(3),d2(5,7); return 0; } 程序的输出结果是A.375B.357C.0375D.0357

考题 有如下类声明: class MyBASE { int k: public; void set(int n){k=n;} int get() const{return k;} }; class MyDERIVED: protected MyBASE { protected: int j; public: void set(int m, int n){MyBASE::set(m);j=n;} int get() const{return MyBASE::get()+j;} }; 则类MyDERIVED中保护的数据成员和成员函数的个数是( )。A.4B.3C.2D.1

考题 给出下面的接口: interface A{ int method1(int i); int method2(int j); } 下面那个类实现了这个接口,并且不是抽象的?() A.class B implements A{ int method1(){} int method2(){} }B.class B { int method1(int i){} int method2(int j){} }C.class B implements A{ int method1(int i){} int method2(int j){} }D.class B extends A{ int method1(int i){} int method2(int j){} }

考题 有如下程序:includeclass Base{protected:int i;public:int j;};class Derived:pub 有如下程序: #include<iostream.h> class Base { protected:int i; public:int j; }; class Derived:public Base { int m; public:int n; }; int main() { Derived d; d.i=0; //[1]d.j=0; //[2]d.m=0; //[3]d.n=0; //[4]return 0; } 其中主函数中有两个赋值语句有错,这两个错误的赋值语句是( )。A.[1]和[2]B.[1)和[3]C.[2]和[3]D.[2]和[4]

考题 有如下类声明: class MyBASE{ int k; public: void set(iht n){k=n;} int get()coast{return k;} }; class MyDERIVED:pnoted My BASE { protected: int j; public: void set(int m,int n){MyBASE::set(m);j=n;} int get()const{return MyBASE::get()+j;} }; 则类MyDERIVED中保护的数据成员和成员函数的个数是A.4B.3C.2D.1

考题 有如下程序:includeusing namespace std;class Base{protected:int i;public:int j;} 有如下程序: #include<iostream> using namespace std; class Base{ protected:int i; public:int j; }; class Derived:public Base{ int m; public:int n; }; int main( ){ Derived d; d.i=0; //[1] d.j=0; //[2] d.n1=0; //[3] d.n=0; //[4] return 0; } 其中主函数中有两个赋值语句有错,这两个错误的赋值语句是A.[1]和[2]B.[1]和[3]C.[2]和[3]D.[2]和[4]

考题 有一个接口定义如下: interface A { int method1(int i); int method2(int j);}那么下面各项中实现了该接口并且不是抽象类的是( )。A.class B implements A { intmethod1(){} intmethod2(){} }B.calss B { int method1(int i){) int method2(int j){} }C.class B implementsA { int method1(int i){} int method2(int j){} }D.class B extendsA { int method1(int i){} int method2(int j){} }

考题 有如下类声明: class MyBASE{ int k; public: void set(int n){k=n;} int get( )const{return k;} }; class MyDERIVED:protected MyBASE{ protected: intj; public: void set(int m,int n){MyBASE::set(m);j=n;} int get( )const{return MyBASE::get( )+j;} }; 则类MyDERIVED中保护的数据成员和成员函数的个数是A.4B.3C.2D.1

考题 有如下类的声明: class Base{ protected: int amount; public: Base(int n=0):amount(n){} int getAmount()const{return amount;} }; class Derived:public Base{ protected: int value public: Derived(int m,int n):value(m),Base(n){} int getData()const{return value+amount;} };已知x是一个Derived对象,则下列表达式中正确的是A.x. value+x. getAmount()B.x. getData()-x. getAmount()C.x. getData()-x. amountD.x. value+x. amount

考题 有如下类声明: class Base{ protected: int amount; public: Base(int n=0):amount(n){} int getAmountconst{retum amount;} }; class Derived:public Base{ protected: int value; public: Derived(int m,int n):value(m),Base(n){} int getDataconst{return value+amount;} }: 已知x是一个Derived对象,则下列表达式中正确的是( )。A.x.value+X.getAmountB.x.getData一x.getAmountC.x.getData一x.amountD.x.value+X.amount

考题 若有以下程序:include using namespace std;class A{private: int x;protected: int 若有以下程序: #include <iostream> using namespace std; class A { private: int x; protected: int y; public: int z; void setx(int i) { x=i; } int getx () { return x; }; class B : protected A { public: void setvalue(int a, int b, int c) { setx (a); y=b; z=c; } void display() { cout<<getx ( ) <<", "<<y<<", "<<z<<", "<<end1; } }; int main () { B obj; obj.setvalue(5, 6, 7); obj.display ( ); return 0; } 程序运行后的输出结果是( )。A.产生语法错误B.7,6,5C.5,6,7D.7,5,6

考题 若有以下程序:include using namespace std;class Base{ int x;protected: int y;pub 若有以下程序: #include <iostream> using namespace std; class Base { int x; protected: int y; public: int z; void setx(int i) { x=i; } int getx ( ) { return x; } }; class Inherit : private Base { private: int m; public: int p; void setvalue(int a,int b,int c, int d) { setx(a) ; y=b; z=c; m=d; } void display() { cout<<getx ()<<", "<<y<<", "<<z<<", "<<m<<end1; } }; int main() { Inherit A; A.setvalue(1,2,3,4); A.display(); return 0; } 程序运行后的输出结果是( )。A.1,2,3,4B.产生语法错误C.4,3,2,1D.2,3,4,5

考题 有一个接口定义如下,下列选项中实现了该接口并且不是抽象的是( )。interface A{ int method1 (int i); int method2 (int j);}A.class B implements A{ int method1() { } int method2() { }}B.class B{int method1(int i) { }int method2(int j) { }}C.class B implements A{ int methodl(int i) { } int method2(intj) { }}D.class B extends A{int method1(int i) { }int method2(int j) { }}

考题 若有以下程序:include using namespace std;class Base{private: int x;protected: i 若有以下程序: #include <iostream> using namespace std; class Base { private: int x; protected: int y; public: int z; void setx(int i) { x=i; int getx () { return x; } }A.1,2,3,4B.产生语法错误C.4,3,2,1D.2,3,4,5

考题 有如下程序:include using namespace std;classBase{protected:int i:public:int j 有如下程序: #include <iostream.h> using namespace std; class Base { protected: int i: public: int j; }; class Derived: public Base { int m: public: int n; } int main() { Derived d: d.i=0; //[1] d.J=0; //[2] d.m=0; //[3] d.n=0: //[4] return 0; } 其中主函数中有两个赋值语句有错,这两个错误的赋值语句是A.[1]和[2]B.[1]和[3]C.[2]和[3]D.[2]和[4]

考题 class A {  protected int method1(int a, int b) { return 0; }  }  Which two are valid in a class that extends class A?() A、 public int method1(int a, int b) { return 0; }B、 private int method1(int a, int b) { return 0; }C、 private int method1(int a, long b) { return 0; }D、 public short method1(int a, int b) { return 0: }E、 static protected int method1(int a, int b) { return 0; }

考题 给定java代码如下所示,在A处新增下列()方法,是对cal方法的重载。public class Test {  public void cal(int x, int y, int z) { } //A } A、public int cal(int x,int y,float z){return 0;}B、public int cal(int x,int y,int z){return 0;}C、public void cal(int x,int z){}D、public viod cal(int z,int y,int x){}

考题 public class MethodOver {   public void setVar (int a, int b, float c) {   }   }   Which two overload the setVar method?()A、 Private void setVar (int a, float c, int b) {}B、 Protected void setVar (int a, int b, float c) {}C、 Public int setVar (int a, float c, int b) (return a;)D、 Public int setVar (int a, int b, float c) (return a;)E、 Protected float setVar (int a, int b, float c) (return c;)

考题 Given:  1. public class Method Over {  2. public void set Var (int a, int b, float c) {  3. }  4. }   Which two overload the set Var method()?A、 private void set Var(int a, float c, int b) {}B、 protected void set Var(int a, int b, float c) {}C、 public int set Var(int a, float c, int b) {return a:}D、 public int set Var(int a, int b, float c) {return a:}E、 protected float set Var(int a, int b, float c) {return c:}

考题 现有:   1. class Synapse {    2.    protected int gap() { return 7; }    3. }   4.     5. class Creb extends Synapse {    6.   // insert code here   7. }    分别插入到第 6 行,哪三行可以编译?()A、 int gap() { return 7; }B、 public int gap() { return 7; }C、 private int gap(int x) { return 7; }D、 protected Creb gap() { return this; }E、 public int gap() { return Integer.getInteger ("42"); }

考题 1. public class Blip {  2. protected int blipvert(int x) { return 0; }  3. }  4. class Vert extends Blip {  5. // insert code here  6. }  Which five methods, inserted independently at line 5, will compile?()  A、 public int blipvert(int x) { return 0; }B、 private int blipvert(int x) { return 0; }C、 private int blipvert(long x) { return 0; }D、 protected long blipvert(int x, int y) { return 0; }E、 protected int blipvert(long x) { return 0; }F、 protected long blipvert(long x) { return 0; }G、protected long blipvert(int x) { return 0; }

考题 多选题1. class Synapse {   2. protected int gap() { return 7; }   3. }   4.   5. class Creb extends Synapse { 6. // insert code here  7. }  分别插入到第 6 行,哪三行可以编译?()Aint gap() { return 7; }Bpublic int gap() { return 7; }Cprivate int gap(int x) { return 7; }Dprotected Creb gap() { return this; }Epublic int gap() { return Integer.getInteger (42); }

考题 单选题1. class Over{   2. int doIt(long x) { return 3;}   3. }   4.   5. class Under extends Over{   6. //insert code here 7. }   和四个方法:   short doIt(int y) {return 4;}   int doIt(long x,long y){return 4;}   private int doIt(Short y){ return 4;}   protected int doIt(long x){return 4;}   分别插入到第6行,有几个可以通过编译?()A 2B 3C 4D 0E 1

考题 多选题1. public class Blip {  2. protected int blipvert(int x) { return 0; }  3. }  4. class Vert extends Blip {  5. // insert code here  6. }  Which five methods, inserted independently at line 5, will compile?()Apublic int blipvert(int x) { return 0; }Bprivate int blipvert(int x) { return 0; }Cprivate int blipvert(long x) { return 0; }Dprotected long blipvert(int x, int y) { return 0; }Eprotected int blipvert(long x) { return 0; }Fprotected long blipvert(long x) { return 0; }Gprotected long blipvert(int x) { return 0; }

考题 多选题现有:   1. class Synapse {    2.    protected int gap() { return 7; }    3. }   4.     5. class Creb extends Synapse {    6.   // insert code here   7. }    分别插入到第 6 行,哪三行可以编译?()Aint gap() { return 7; }Bpublic int gap() { return 7; }Cprivate int gap(int x) { return 7; }Dprotected Creb gap() { return this; }Epublic int gap() { return Integer.getInteger (42); }

考题 多选题给定java代码如下所示,在A处新增下列()方法,是对cal方法的重载。public class Test {  public void cal(int x, int y, int z) { } //A }Apublic int cal(int x,int y,float z){return 0;}Bpublic int cal(int x,int y,int z){return 0;}Cpublic void cal(int x,int z){}Dpublic viod cal(int z,int y,int x){}