题目内容 (请给出正确答案)
给出下列代码: 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(); } } 结果是什么?
[单选题]

给出下列代码: 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

提问人:网友肖和成 发布时间:2022-01-07
参考答案
查看官方参考答案
如搜索结果不匹配,请 联系老师 获取答案
网友答案
查看全部
  • · 有4位网友选择 D,占比40%
  • · 有4位网友选择 B,占比40%
  • · 有1位网友选择 A,占比10%
  • · 有1位网友选择 C,占比10%
匿名网友 选择了D
[63.***.***.141] 1天前
匿名网友 选择了B
[68.***.***.65] 1天前
匿名网友 选择了D
[40.***.***.93] 1天前
匿名网友 选择了D
[183.***.***.62] 1天前
匿名网友 选择了B
[30.***.***.211] 1天前
匿名网友 选择了D
[54.***.***.231] 1天前
匿名网友 选择了B
[14.***.***.186] 1天前
匿名网友 选择了B
[185.***.***.165] 1天前
匿名网友 选择了C
[167.***.***.30] 1天前
匿名网友 选择了A
[217.***.***.225] 1天前
加载更多
提交我的答案
登录提交答案,可赢取奖励机会。
更多“给出下列代码: class?Plane?{ static?S…”相关的问题
第1题
给出下面的代码:

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.输出为null

点击查看答案
第2题
下面代码正确吗? public class Test implements Runnable { public static void main(String[ ] args) { Test t = new Test(); } public Test() { Thread t = new Thread(this); t.start(); } public void run() { System.out.println("test"); } }
点击查看答案
第3题
给出下面的代码:

class Person{

String name,department ;

public void printValue(){

System.out.println("name is"+name);

System.out.println("department is "+department);

}

}

public class Teacher extends Person{

int salary;

public void printValue(){

//doing the same as in the parent method printValue()

//including print the value of name and department.

System.out.printin("salary is"+salary);

}

}

下面的______表达式可以加入printValue()方法的”doing the same as…”部分.

A.printValue();  B.this.printValue();

C.person.printValue();D.super.printValue();

点击查看答案
第4题
下列程序中哪些【代码】是错误的?若有错误,请给出正确语句。 public class Ex { public static void main(String args[]) { int x=8; byte b=-127; //【代码1】 b=x; //【代码2】 x=12L; //【代码3】 long y=8.0; //【代码4】 float z=5.543; //【代码5】 } }
点击查看答案
第5题
给出下面的代码:

public class Parent{

public int addValue(int a,int b){

int s;

s=a+b;

return s;

}

}

class Child extends Parent{

}

以下方法可以加入类Child中的是______。

A.int addValue(int a,int b){//do something…}

B.public void addValue(){//do something…}

C.public int addValue(int a){//do something…}

D.public int addValue(int a,int b)throws MyException{//do something…}

点击查看答案
第6题
给出下面代码: a = input("").split(",") if isinstance(a,list): print("{} is list".format(a)) else: print("{} is not list".format(a)) 代码执行时,从键盘获得1,2,3,则代码的输出结果是: ______。

A、1,2,3 is list

B、['1', '2', '3'] is list

C、执行代码出错

D、1,2,3 is not list

点击查看答案
第7题
【填空题】下面程序段的执行结果是【1】。 public class Test{ public static void main(String[] args) { try{ return; } finally{ System.out.println("Finally"); } } }
点击查看答案
第8题
判断下列代码段的大O级别 test = 0 for i in range(n): test = test + 1 for j in range(n): test = test - 1

A、O(n)

B、O(n^2)

C、O(log n)

D、O(n^3)

点击查看答案
第9题
给出下面不完整的类代码:

class Person {

String name, department;

int age;

public Person(String n){ name=n; }

public Person(String n, int a){name=n; age=a; }

public Person(String n, String d, int a) {

// doing the same as two arguments version of constructor

// including assignment name=n,age=a

department=d;

}

}

下面的表达式可以加到构造方法中的"doing the same as…”处的是______。

A.Person(n,a); B.this(Person(n,a));C.this(n,a);  D.this(name,age);

点击查看答案
第10题
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

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

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

简答题官方微信公众号

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

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

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