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

指出下列程序的输出结果是什么? public static void main(String args[]){ final int A = 4; int a = 2; switch(a*2){ case A:System.out.println(a); default:System.out.println(a*2); } }

A.2

B.4

C.2和4

D.编译出错

参考答案
简答题官方参考答案 (由简答题聘请的专业题库老师提供的解答)
查看官方参考答案
网友提供的答案
位网友提供了参考答案,
查看全部
  • · 有3位网友选择 C,占比37.5%
  • · 有3位网友选择 A,占比37.5%
  • · 有2位网友选择 D,占比25%
匿名网友[220.***.***.80]选择了 C
1天前
匿名网友[40.***.***.103]选择了 D
1天前
匿名网友[43.***.***.168]选择了 A
1天前
匿名网友[220.***.***.80]选择了 C
1天前
匿名网友[155.***.***.35]选择了 C
1天前
匿名网友[62.***.***.93]选择了 A
1天前
匿名网友[40.***.***.103]选择了 D
1天前
匿名网友[250.***.***.218]选择了 C
1天前
匿名网友[221.***.***.37]选择了 A
1天前
匿名网友[66.***.***.38]选择了 D
1天前
匿名网友[43.***.***.168]选择了 A
1天前
匿名网友[62.***.***.93]选择了 A
1天前
匿名网友[155.***.***.35]选择了 C
1天前
匿名网友[62.***.***.93]选择了 A
1天前
匿名网友[40.***.***.103]选择了 D
1天前
匿名网友[250.***.***.218]选择了 C
1天前
匿名网友[221.***.***.37]选择了 A
1天前
匿名网友[66.***.***.38]选择了 D
1天前
匿名网友[43.***.***.168]选择了 A
1天前
匿名网友[220.***.***.80]选择了 C
1天前
提交我的答案
登录提交答案,可赢取奖励机会。
更多“指出下列程序的输出结果是什么? public static void main(String args[]){ final int A = 4; int a = 2; switch(a*2){ cas…”相关的问题
第1题
请阅读下面的程序,写出最终的结果: interface Inter { public void show(); } abstract class AbstractInter implements Inter { public void show() { System.out.println("AbstractInter show()"); } } class InterImpl extends AbstractInter { public void show() { System.out.println("InterImpl show()"); } } public class InterImplTest { public static void main(String[] args) { InterImpl i = new InterImpl(); i. show(); } }
点击查看答案
第2题
设有如下代码 public class Test{ static int x[] = new int[10]; public static void main ( String arg[] ) { System.out.println(x[0]); } } 哪个叙述为真?

A、运行出错

B、出现编译错误

C、输出 0

D、输出 null

点击查看答案
第3题
以下代码 class FinalTest{ final int num = 1; public static void main(String[] args) { final FinalTest ft = new FinalTest();//1 ft.num = 100;//2 //3 System.out.println(ft.num);//4 } }

A、编译通过,但在//3处加上 ft.num ++; 后编译报错

B、编译通过,但在//3处加上 ft = new FinalTest(); 后编译报错

C、编译不通过,去除//1的 final 后编译通过

D、编译不通过,删除//2 整行后编译通过

点击查看答案
第4题
class NumTest{ final int id = 1; int id2 = 1; NumTest(int id,int id2){ this.id = id; this.id2 = id2; } void printId(){ System.out.print(id+id2+" "); } public static void main(String[] args) { NumTest a = new NumTest(1,2); NumTest b = new NumTest(2,1); NumTest c = new NumTest(0,0); a.printId(); b.printId(); c.printId(); } }

A、3 3 0

B、1 2 0

C、2 1 0

D、编译报错

点击查看答案
第5题
程序的运行结果是 public class Example02 { public static void main(String[] args) { int x = 0; // 定义变量x,初始值为0 int y = 0; // 定义变量y,初始值为0 boolean b = x==0 || y++<0; system.out.println("b="+b+" , y="+y); } } &lt;br&gt; A、b = false, y = 0 &lt;br&gt; B、b = false, y = 1 &lt;br&gt; C、b = true, y = 0 &lt;br&gt; D、b = true, y = 1 &lt;br&gt; &lt;p class=" answer">

8、下列选项中,关于运算符“^”的描述正确是

A、二进制位有1,则结果为1

B、二进制位有0,则结果为0

C、二进制位有相同,则结果为1,不同为0

D、二进制位有相同,则结果为0,不同为1

点击查看答案
第6题

下列程序的输出结果为 class Box{ int length,width,height; public void setInfo(int l,int w,int h){ length = l; width = w; height = h; } public int volumn(){ return length*width*height; } public int area(){ return (length*width + length*height + width*height) * 2; } public String toString(){ return "Length:" + length + " width:" + width + " height:" + height + " volumn: " + volumn() + " area:" + area(); } } public class BoxTest { public static void main(String[] args) { Box b = new Box(); b.setInfo(5,2,4); System.out.println(b.toString()); } }

点击查看答案
第7题
下列代码的执行结果是 f=open('writetest.txt','a+') f.write('This is a test file') f.write('Please print this file') print(f.readline()) f.seek(0) print(f.readlines())

A、This is a test file This is a test file Please print this file

B、This is a test filePlease print this file This is a test file Please print this file

C、['This is a test filePlease print this file']

D、This is a test filePlease print this file

点击查看答案
第8题
switch语句不能用于下列哪种数据类型

A、double

B、byte

C、short

D、char

点击查看答案
第9题
以下语句中属于合法类型转换的是

A、(int)"A"

B、(char)"A"

C、(Boolean)(2-2)

D、(char)(651/12)

点击查看答案
第10题
下面声明float变量的语法正确的是

A、float foo = -1;

B、float foo = 1.0;

C、float foo = 42e1;

D、float foo = 2.02f

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

1. 搜题次数扣减规则:

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

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

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

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

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

订单号:

遇到问题请联系在线客服

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

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

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

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

简答题官方微信公众号

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