搜题
网友您好,请在下方输入框内输入要搜索的题目:
搜题
题目内容 (请给出正确答案)
提问人:网友wind00123 发布时间:2022-01-06
[主观题]

在下列源代码文件Test.java中,哪个选项是正确的类定义?A.public class test{ public int x=0; pu

在下列源代码文件Test.java中,哪个选项是正确的类定义?

A.public class test{ public int x=0; public test(int x ) { this.x=x; } }

B.public class Test { public int x=0; public Test(int x ) { this.x=x; } }

C.public class Test extends T1 T2 { public int x=0; public Test(int x){ this.x=x; } }

D.protected class Test extends T2 { public int x=0; public Test(int x) { this.x=x; } }

简答题官方参考答案 (由简答题聘请的专业题库老师提供的解答)
查看官方参考答案
更多“在下列源代码文件Test.java中,哪个选项是正确的类定义?A.public class test{ public int x=0; pu”相关的问题
第1题
类Test1定义如下: 1.public class Test1{ 2. public float aMethod(float a,float b){ } 3. 4.} 下面方法中插入行3处为不合法的是( )。

A、public float aMethod(float a, float b,float c){ }

B、public float aMethod(float c,float d){ }

C、public int aMethod(int a, int b){ }

D、private float aMethod(int a,int b,int c){ }

点击查看答案
第2题
Test类的定义如下: public class Test { public Test() { System.out.println("构造方法一被调用了。。"); } public Test(int x) { System.out.println("构造方法二被调用了。。"); } public Test(boolean b) { System.out.println("构造方法三被调用了。。"); } public static void main(String[] args) { Test test=new Test(true); } } 上面程序的运行结果为下列哪一项?( )

A、构造方法一被调用了。。

B、构造方法二被调用了。。

C、构造方法三被调用了。。

D、其余三个选项之和

点击查看答案
第3题
在下列源代码文件Test.java中, ()是正确的类定义。

A.public class test{

B.public class Test{ public int x=0;public int x=0; public test (intx) public Test (int x){ {this.x=x; this.x=x;} }} }

C.public class Test extends T1,T2{

D.protected class Test extends T2{ public int=0;public int x=0; public Test(int x){Public Test (int x){ this.x=x;this.x=x: }} }}

点击查看答案
第4题
有如下定义和语句: class Student { public: void display(){ cout< <num> <<" }; private: int num; char name[30]; } ; student t, *p="&amp;t;" 下面正确的语句是(> A、p->display( );

B、t->display();

C、p-> num = 10101;

D、(*p)-> display();

点击查看答案
第5题
考虑如下代码,其中包括一个内嵌类: public final class Test4 { class Inner { void test() { if (Test4.this.flag) { sample(); } } } private boolean flag = false; public void sample() { System.out.println("Sample"); } public Test4() { (new Inner()).test(); } public static void main(String args []) { new Test4(); } } 结果为?

A、输出 "Sample"

B、程序无输出,但正确终止

C、程序不能终止

D、程序编译失败

点击查看答案
第6题
有如下类定义: public class ClassAndVariables{     public static int x = 8;      public int y = 9;  } 执行如下代码: ClassAndVariables a = new ClassAndVariables(); ClassAndVariables b = new ClassAndVariables(); a.y = 5; b.y = 6; a.x = 1; b.x = 2; 则a.y, b.y, a.x, b.x的值分别为:

A、5, 6, 1, 2

B、6, 6, 1, 2

C、5, 6, 2, 2

D、6, 6, 2, 2

点击查看答案
第7题
在下列源代码文件Test.java中,哪个选项是正确的类定义? ()

A.public class test { public int x=0; public test(int x) { this.x=x; } }

B.public class Test { public int x=0; public Test(int x) { this.x=x; } }

C.public class Test extends Ti,T2 { public int x=0; public Test(int x) { this.x=x; } }

D.protected class Test extends T2 { public int x=0; public Test(int x) { this.x=x; } }

点击查看答案
第8题
编译并运行下述程序段的结果是 public class Test{ public static void main(String argv[]){ int[] count = new int[4]; System.out.println(count[4]); } }

A、编译错误

B、运行错误

C、输出0

D、输出null

点击查看答案
第9题
下列关于垃圾回收的说法正确的是

A、程序员必须创建一个线程来释放内存

B、垃圾回收程序负责释放无用内存

C、垃圾回收程序允许程序员直接释放内存

D、垃圾回收程序可以在指定的时间释放内存对象

点击查看答案
第10题
导入包A中的类AA应该使用哪条语句

A、import A.AA

B、import AA.A

C、package A

D、package AA

点击查看答案
重要提示: 请勿将账号共享给其他人使用,违者账号将被封禁!
查看《购买须知》>>>
重置密码
账号:
旧密码:
新密码:
确认密码:
确认修改
购买搜题卡查看答案
购买前请仔细阅读《购买须知》
请选择支付方式
微信支付
支付宝支付
点击支付即表示你同意并接受《服务协议》《购买须知》
立即支付
搜题卡使用说明

1. 搜题次数扣减规则:

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

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

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

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

请使用微信扫码支付(元)

订单号:

遇到问题请联系在线客服

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

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

- 微信扫码关注简答题 -
警告:系统检测到您的账号存在安全风险
抱歉,您的账号因涉嫌违反简答题购买须知被冻结。您可在“简答题”微信公众号中的“官网服务”-“账号解封申请”申请解封,或联系客服
- 微信扫码关注简答题 -
请用微信扫码测试
欢迎分享答案

为鼓励登录用户提交答案,简答题每个月将会抽取一批参与作答的用户给予奖励,具体奖励活动请关注官方微信公众号:简答题

简答题官方微信公众号

简答题
下载APP
关注公众号
TOP