题目内容 (请给出正确答案)
[单选题]

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.3 3 0

B.1 2 0

C.2 1 0

D.编译报错

提问人:网友ply52008 发布时间:2022-01-07
参考答案
查看官方参考答案
如搜索结果不匹配,请 联系老师 获取答案
网友答案
查看全部
  • · 有4位网友选择 A,占比44.44%
  • · 有2位网友选择 B,占比22.22%
  • · 有2位网友选择 D,占比22.22%
  • · 有1位网友选择 C,占比11.11%
匿名网友 选择了A
[254.***.***.166] 1天前
匿名网友 选择了B
[149.***.***.79] 1天前
匿名网友 选择了D
[50.***.***.44] 1天前
匿名网友 选择了B
[237.***.***.138] 1天前
匿名网友 选择了A
[128.***.***.69] 1天前
匿名网友 选择了A
[21.***.***.81] 1天前
匿名网友 选择了D
[167.***.***.100] 1天前
匿名网友 选择了A
[179.***.***.130] 1天前
匿名网友 选择了C
[94.***.***.241] 1天前
加载更多
提交我的答案
登录提交答案,可赢取奖励机会。
更多“class NumTest{ final int id = …”相关的问题
第1题
以下代码执行结果是 class StaticTest{ static{ System.out.print("a "); } { System.out.print("b "); } public static void main(String[] args) { StaticTest st2 = new ChildTest(); //main1 System.out.print(“ # ”); //main2 StaticTest st = new StaticTest(); //main3 } } class ChildTest extends StaticTest{ static{ System.out.print("c "); } }

A、a c b # a b

B、a b c # a b c

C、a c b # b

D、a b c # a b

点击查看答案
第2题
下列代码执行结果是 class NumTest{ final static int num1 = 1; static int num2 = 1; void printNum1(){ System.out.print(num1+" "); } void printNum2(){ System.out.print(num2+" "); } public static void main(String[] args) { NumTest a = new NumTest(); a.num1 ++; a.printNum2(); NumTest b = new NumTest(); b.printNum1(); } }

A、2 1

B、1 2

C、1 1

D、编译报错

点击查看答案
第3题
新建Work07-01项目,里面有一个com.test.Worker类,类代码如下: package com.test; class Worker { public void sayHello() { System.out.println("hello"); } } 将此类导出为worker.jar。 新建Work07-02项目,里面有一个com.bussiness.Boss类,Boss类的代码如下: package com.bussiness; import com.test.Worker; class Boss { public static void main(String[] a) { Worker w = new Worker(); w.sayHello(); } } 需要在Work07-02里面导入work.jar。 作业需要提交3个截图:导出jar,导入jar,Boss运行结果。
点击查看答案
第4题
完成第七章第二节后半部分的H.java, F.java, C.java的命令行编译和运行。这几个类的源码已经在课件材料中可以下载。学生需要在控制台命令行下,执行每个类的编译和运行命令,并截图提交,共6个图,3个编译,3个运行和运行结果。
点击查看答案
第5题
pubic void test () { try { oneMethod (); System.out.print ( "condition 1"); } catch ( Exception e ) { System.out.print ( "condition 3"); } catch ( ArithmeticException e ) { System.out.print ( "condition 2" ); } finally { System.out.println ("condition 4" ); } } Which will display if oneMethod throw NullPointerException?

A、condition 1 Condition4

B、condition 2 Condition4

C、condition 3 Condition4

D、error in compilation

点击查看答案
第6题
给出如下代码段: try { int x = Integer.parseInt("two"); } 下列哪个可以作为catch的异常?

A、ClassCastException

B、IllegalStateException

C、NumberFormatException

D、ExceptionInInitializerError

点击查看答案
第7题
给出下列代码: class Plane { static String s = "-"; public static void main(String[] args){ new Plane().s1(); System.out.println(s); } void s1() { try {s2();}catch (Exception e){  s += "c";  } } void s2() throws Exception { s3();  s += "2"; s3(); s += "2b"; } void s3() throws Exception{ throw new Exception(); } } 结果是什么?

A、-

B、-c

C、-c2

D、-2c

点击查看答案
第8题
Given import java.io.*; class Main{ public void f1() throws ArithmeticException{} public void f2() throws FileNotFoundException{} public static void main(){ new Main().f1(); //line1 new Main().f2(); //line2 } } Which is correct?

A、No error in compilation

B、error at //line1 in compilation

C、error at //line2 in compilation

D、two errors at //line1 and //line2 in compilation

点击查看答案
第9题
class Emu{ static String s = "-"; public static void main(String[] args){ try{ throw new Exception(); }catch(Exception e){ try{ try{ throw new Exception(); }catch (Exception ex){ s += "ic "; } throw new Exception(); } catch(Exception x){ s += "mc "; } finally{ s += "mf "; } }finally{ s += "of "; } System.out.println(s); } } What is the result?

A、-ic mf of

B、-ic mc mf of

C、-ic mc of mf

D、Compilation fails

点击查看答案
第10题
Given: import java.io.*; class Master { String doFileStuff() throws FileNotFoundException {  return "a";  } } class Slave extends Master { public static void main(String[] args){ String s = null; try {  s = new Slave().doFileStuff(); }catch ( Exception x){ s = "b";  } System.out.println(s); } // insert code here } Which, inserted independently at // insert code here, will compile, and produce the output b? (Choose all that apply.)

A、String doFileStuff() { return "b"; }

B、String doFileStuff() throws IOException { return "b"; }

C、String doFileStuff(int x) throws IOException { return "b"; }

D、String doFileStuff() throws Exception { return "b"; }

点击查看答案
账号:
你好,尊敬的用户
复制账号
发送账号至手机
密码将被重置
获取验证码
发送
温馨提示
该问题答案仅针对搜题卡用户开放,请点击购买搜题卡。
马上购买搜题卡
我已购买搜题卡, 登录账号 继续查看答案
重置密码
确认修改
欢迎分享答案

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

简答题官方微信公众号

警告:系统检测到您的账号存在安全风险

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

微信搜一搜
简答题
点击打开微信
警告:系统检测到您的账号存在安全风险
抱歉,您的账号因涉嫌违反简答题购买须知被冻结。您可在“简答题”微信公众号中的“官网服务”-“账号解封申请”申请解封,或联系客服
微信搜一搜
简答题
点击打开微信