重要提示: 请勿将账号共享给其他人使用,违者账号将被封禁!
查看《购买须知》>>>
找答案首页 > 全部分类 > 计算机类考试
搜题
网友您好, 请在下方输入框内输入要搜索的题目:
搜题
题目内容 (请给出正确答案)
[单选题]

下面方法在A的子类中属于重写方法的是()class A {protected int method1 (int a, int b) {return 0;}}

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

查看答案
更多“下面方法在A的子类中属于重写方法的是()class A {protected int method1 (int a, int b) {return 0;}}”相关的问题

第1题

classA{protectedintmethod1(inta,intb){return0;}}WhichtwoarevalidinaclassthatextendsclassA?()

A.publicintmethod1(inta,intb){return0;}

B.privateintmethod1(inta,intb){return0;}

C.privateintmethod1(inta,longb){return0;}

D.publicshortmethod1(inta,intb){return0:}

E.staticprotectedintmethod1(inta,intb){return0;}

点击查看答案

第2题

下面程序运行的结果是( )。 #include<iostream> using namespace std; class A{ protected: int a; public: void input(int i) {a=i;} }; class B{ protected: int a; public: void input(int j) {a=j;} }; class C: public A, public B { int x; public: void input() {x=A::a * B::a;cout<<x<<endl;} }; void main() { C c; c.A::input(5); c.B::input(8); c.input(); }

A.5

B.8

C.40

D.编译出错

点击查看答案

第3题

已定义类A:

classA{

privateintx=1;

protectedinty=2;

publicintz=3;

publicintsumA(){return(x+y+z);

}

}

再通过继承与扩展定义子类B:

classBextendsA{

privateintb=4;

publicintsumB(){

ints=0;

s+=x;s+=y;s+=z;s+=b;

returns;

}

}

方法成员sumB()中错误的语句是()。

A、s+=x;

B、s+=y;

C、s+=z;

D、s+=b;

点击查看答案

第4题

若有以下程序: #include <iostream> using namespace std; class A { protected: int a; public: A() { a=10; } }; class A1 : public A { public: A1() { a=a+1; } }; class A2 : public A { public: A2 () { a=a+2; } }; class B : public A1,public A2 { public: B(){} void print() { cout<<a<<end1; } }; int main ( ) { B obj; obj.print(); return 0; } 程序运行后的输出结果是( )。

A.产生语法错误

B.11

C.12

D.10

点击查看答案

第5题

下面程序的运行结果为 #include < iostream.h > class A { static int n; public: A( ){n=1;} A(int num){ n = num;} void print( ){cout<< n;} }; int A::n=2; void main( ) { A a,b (3); a.print( ); b.print( ); cout<< end1; }

A.11

B.13

C.23

D.33

点击查看答案

第6题

下面程序的运行结果为 #include < iostream.h > class A { static int n; public: A( ){n=1;} A(int num){ n = num;} void print( ){cout<< n;} }; int A::n=2; void main( ) { A a,b (3); a.print( );

A.11

B.13

C.23

D.33

点击查看答案

第7题

下面程序的运行结果为

#include

class A

{

static int n;

public:

A(){n=1;}

A(int num){n=num;}

void print(){coot <

}

int A::n=2:

void main()

{

A a.b(3);

a.print();

b.pint();

cout <

}

A.11

B.13

C.23

D.33

点击查看答案

第8题

下面程序的运行结果为 #include<iostream.h> class A { static int n; public: A(){n=1;} A(intnum){n=num;} void print(){cout <<n;} }; int A∷n=2; void main() { Aa,b(3); a.print(); b.print(); cout <<end1; }

A.11

B.13

C.23

D.33

点击查看答案

第9题

class A{public int getNumber(int a){return a+1;}}class B extends A{public int getNumber
class A

{public int getNumber(int a){return a+1;}}

class B extends A

{public int getNumber(int a, char c){return a+2;}public static void main(String[] args){B b=new B();System.out.println(b.getNumber(0));}}

what is the result?()

A.compilation succeeds and 1 is printed

B.compilation succeeds and 2 is printed

C.compilation succeeds and 3 is printed

D.An error at this program cause compilation to fail

点击查看答案

第10题

类A及其派生类B定义如下:class A{ public int getIno(int a) { return a; }}public class B extends A{ public loat getIno(int b) { return b; } public static void main(String[]args) { A a=new A(); B b=new B(); System.out.println(a.getIno(3)+","+b.getIno(5)); }}关于上述程序代码的叙述中正确的是 ( )

A.第10行不能通过编译

B.程序通过编译,输出结果为:3,3

C.程序通过编译,输出结果为3,5

D.程序通过编译,输出结果为:5,5

点击查看答案
下载上学吧APP
客服
TOP
重置密码
账号:
旧密码:
新密码:
确认密码:
确认修改
购买搜题卡查看答案
购买前请仔细阅读《购买须知》
请选择支付方式
微信支付
支付宝支付
选择优惠券
优惠券
请选择
点击支付即表示你同意并接受《服务协议》《购买须知》
立即支付
搜题卡使用说明

1. 搜题次数扣减规则:

功能 扣减规则
基础费
(查看答案)
加收费
(AI功能)
文字搜题、查看答案 1/每题 0/每次
语音搜题、查看答案 1/每题 2/每次
单题拍照识别、查看答案 1/每题 2/每次
整页拍照识别、查看答案 1/每题 5/每次

备注:网站、APP、小程序均支持文字搜题、查看答案;语音搜题、单题拍照识别、整页拍照识别仅APP、小程序支持。

2. 使用语音搜索、拍照搜索等AI功能需安装APP(或打开微信小程序)。

3. 搜题卡过期将作废,不支持退款,请在有效期内使用完毕。

请使用微信扫码支付(元)
订单号:
遇到问题请联系在线客服
请不要关闭本页面,支付完成后请点击【支付完成】按钮
遇到问题请联系在线客服
恭喜您,购买搜题卡成功 系统为您生成的账号密码如下:
重要提示: 请勿将账号共享给其他人使用,违者账号将被封禁。
发送账号到微信 保存账号查看答案
怕账号密码记不住?建议关注微信公众号绑定微信,开通微信扫码登录功能
警告:系统检测到您的账号存在安全风险

为了保护您的账号安全,请在“上学吧”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!

- 微信扫码关注上学吧 -
警告:系统检测到您的账号存在安全风险
抱歉,您的账号因涉嫌违反上学吧购买须知被冻结。您可在“上学吧”微信公众号中的“官网服务”-“账号解封申请”申请解封,或联系客服
- 微信扫码关注上学吧 -
请用微信扫码测试
选择优惠券
确认选择
谢谢您的反馈

您认为本题答案有误,我们将认真、仔细核查,如果您知道正确答案,欢迎您来纠错

上学吧找答案