题目内容 (请给出正确答案)
[主观题]

给出下面的代码: 1)public Void modify() { 2)int i, j, k; 3)i=100; 4)while (i>0 ) { 5)j=i*2; 6)

给出下面的代码:

1)public Void modify() {

2)int i, j, k;

3)i=100;

4)while ( i>0 ) {

5)j=i*2;

6)System.out.println ("The value of j is"+j );

7)k=k+ 1;

8)i--;

9)}

10)}

第______行在编译时可能产生错误。

A.4 B.6

C.7 D.8

提问人:网友anonymity 发布时间:2022-01-06
参考答案
查看官方参考答案
如搜索结果不匹配,请 联系老师 获取答案
更多“给出下面的代码: 1)public Void modify(…”相关的问题
第1题
给出下面的代码:

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();

点击查看答案
第2题
给出下面的代码:

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…}

点击查看答案
第3题
给出下面代码: 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

点击查看答案
第4题
判断下列代码段的大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)

点击查看答案
第5题
对于如下代码: Circle *pCircle2 = new Circle(5.9);释放内存的正确语句是:

A、free(pCircle2);

B、delete pCircle2;

C、delete pCircle2(5.9);

D、delete Circle(5.9);

点击查看答案
第6题
给出以下语句:

String s="hello";

String t="hello";

char c[]={'h','e','l','l','o'};

以下语句返回true的是______。

A.s.equals(t);  B.t.equals(c);

C.s==t;D.t.equals(new String("hello"));

E.t==c;

点击查看答案
第7题
给出下面的代码片断:

1)String str=null;

2)if ((str !=null) && (str.length() >10)) {

3)System.out.println("more than 10");

4)}

5)else if ((str !=null) & (str.length() <5)) {

6)system.out.println("less than 5");

7)}

8)else ( system.out.println("end"); }

第______行将导致错误.

A.1  B.2

C.5  D.8

点击查看答案
第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.输出为null

点击查看答案
第9题
下面代码正确吗? 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"); } }
点击查看答案
账号:
你好,尊敬的用户
复制账号
发送账号至手机
密码将被重置
获取验证码
发送
温馨提示
该问题答案仅针对搜题卡用户开放,请点击购买搜题卡。
马上购买搜题卡
我已购买搜题卡, 登录账号 继续查看答案
重置密码
确认修改
欢迎分享答案

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

简答题官方微信公众号

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

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

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