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

对于下列代码,下列哪个叙述是正确的? class A { public int i=0; A(int m) { i = 1; } } public

对于下列代码,下列哪个叙述是正确的? class A { public int i=0; A(int m) { i = 1; } } public class B extends A { B(int m) { i = 2; } public static void main(String args[]){ B b = new B(100); System.out.println(b.i); //【代码】 } }

A、程序提示编译错误。

B、编译无错误,【代码】输出结果是0。

C、编译无错误,【代码】输出结果是1。

D、编译无错误,【代码】输出结果是2。

查看答案
更多“对于下列代码,下列哪个叙述是正确的? class A { public int i=0; A(int m) { i = 1; } } public”相关的问题

第1题

请说出E类中【代码1】~【代码3】的输出结果并分析原因。 class A { int m; int getM() { return m; } int seeM() { return m; } } class B extends A { int m ; int getM() { return m+100; } } public class E { public static void main(St
点击查看答案

第2题

请写出代码的运行结果。 class A{ int f(int x,int y){ return x+y; } } class B extends A{ int f(int x,int y){ int m = super.f(x,y)+10; return m; } } public class E{ public static void main(String args[]){ A a = new
点击查看答案

第3题

下列程序中注释的哪个代码(A,B,C,D)是错误的(无法通过编译)? class A { static int m; static void f(){ m = 20 ; //A } } class B extends A { void f() //B { m = 222 ; //C } } class E { public static void main(String args[]) { A.f

A、A

B、B

C、C

D、D

点击查看答案

第4题

请说出E类中【代码1】,【代码2】的输出结果并分析原因。 interface Com { int add(int a,int b); } abstract class A { abstract int add(int a,int b); } class B extends A implements Com{ public int add(int a,int b) { return a+b; } }
点击查看答案

第5题

请说出E类中【代码1】~【代码4】的输出结果并分析原因。 cl...

请说出E类中【代码1】~【代码4】的输出结果并分析原因。 class A { double f(double x,double y) { return x+y; } static int g(int n) { return n*n; } } class B extends A { double f(double x,double y) { double m = super.f(x,y); return m+x*y; } static int g(int n) { int m = A.g(n); return m+n; } } public class E { public static void main(String args[]) { B b = new B(); System.out.println(b.f(10.0,8.0)); //【代码1】 System.out.println(b.g(3)); //【代码2】 A a = new B(); System.out.println(a.f(10.0,8.0)); //【代码3】 System.out.println(a.g(3)); //【代码4】 } }

点击查看答案

第6题

定义类A和B:class A { public: int x, y; }; class B { public: A m1; int m2; double m3; void fun( A a ) { ...... } }; 组合类B中的对象成员是( )。

A、m1

B、m2

C、m3

D、fun

点击查看答案

第7题

下列构造URL的程序正确的是?A、public class URLdomo{URL url;public URLdemo( ){url=new URL(&
下列构造URL的程序正确的是?

A、public class URLdomo{URL url;public URLdemo( )

{url=new URL("http","java.sun.com",8080,"doc1.html");}};

B、public class URLdomo{URL url;public URLdemo( )

{try{url=new URL("http","java.sun.com",8080,"doc1.html");}

catch(MalformedURLException e){ System.out.println("MalformedURLException");}}};

C、public class URLdomo{URL url;public URLdemo( )

{url=new URL("http://java.sun.com:8080/doc1.html");}};

D、public class URLdomo{URL url;public URLdemo( )

{try{url=new URL("http://java.sun.com:8080/doc1.html");}

catch(MalformedURLException e){ System.out.println("MalformedURLException");}}}

点击查看答案

第8题

请看下面的程序段:public class Person{static int arr[] = new int[10];public static void main(String a[]) {System 、out 、println(arr[1]);}}下面说法正确的是()。

A、当编译时会发生错误

B、编译不会发生错误但执行是会发生错误

C、输出结果为0

D、不会输出结果

点击查看答案

第9题

下列注释标记哪处有错。 abstract class A{ int m=100; } class D extends A{ double m; } public class E { public static void main(String[] args) { A a = null; D d = new D(); //1 a=d; //2 d.m=3.14; //3 a.m=3.14; //4

A、4

B、2

C、3

D、1

点击查看答案

第10题

有以下程序结构,请分析访问权限。 class A {public: void f1(); protected: void f2(); private: int k; }; class B:public A {public: void f3(); protected: int m; private: int n; }; class C:public B {public: void f4(); pri
点击查看答案
下载上学吧APP
客服
TOP
重置密码
账号:
旧密码:
新密码:
确认密码:
确认修改
购买搜题卡查看答案
购买前请仔细阅读《购买须知》
请选择支付方式
微信支付
支付宝支付
选择优惠券
优惠券
请选择
点击支付即表示你同意并接受《服务协议》《购买须知》
立即支付
搜题卡使用说明

1. 搜题次数扣减规则:

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

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

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

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

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

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

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

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

上学吧找答案