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

以下的程序的调试结果为public class Scope{int i;public static void main(String argv[]){Scope s = new Scope();s.amethod();}public static void amethod(){System.out.println(i);}}

A. 输出结果为:0

B. 无输出

C. 编译错误

D. 输出null

查看答案
如搜索结果不匹配,请 联系老师 获取答案
您可能会需要:
您的账号:,可能会需要:
您的账号:
发送账号密码至手机
发送
更多“以下的程序的调试结果为public class Scope{…”相关的问题

第1题

下列说法错误的一项是?

A.getDocumentBase()用于获取包含Applet的HTML文件的URL

B.getCodeBase()用于获取Applet主类的URL

C.getParameter(String name)用于获取标记中的参数值

D.若指定参数在HTML中没有说明,则Applet将停止运行。

点击查看答案

第2题

考虑如下类:1. class Test(int i) {2. void test(int i) {3. System.out.println("I am an

考虑如下类:

1. class Test(int i) {

2. void test(int i) {

3. System.out.println("I am an int.");

4. }

5. void test(String s) {

6. System.out.println("I am a string.");

7. }

8.

9. public static void main(String args[]) {

10. Test t=new Test();

11. char ch="y";

12. t.test(ch);

13. }

14. }

以下哪条为真?

A.行 5 不能通过编译,方法不能被覆盖.

B.行 12 不能通过编译, 因为没有一个test()方法含字符参数.

C.代码可以编译但在12行将出现异常.

D.代码可以编译且产生如下输出: I am an int.

E.代码可以编译且产生如下输出: I am a String.

点击查看答案

第3题

以下程序调试结果为:class Base{Base(){int i = 100;System.out.print (i);}}public class Pri extends Base{static int i = 200;public static void main(String argv[]){Pri p = new Pri();System.out.print(i);}}

A.编译错误

B.200

C.100200

D.100

点击查看答案

第4题

编译和运行以下程序结果为:1: public class Q21 {2: int maxElements;3: void Q21() {4: maxEl

编译和运行以下程序结果为:

1: public class Q21 {

2: int maxElements;

3: void Q21() {

4: maxElements = 100;

5: System.out.println(maxElements);

6: }

7: Q21(int i) {

8: maxElements = i;

9: System.out.println(maxElements);

10: }

11: public static void main(String[] args) {

12: Q21 a = new Q21();

13: Q21 b = new Q21(999);

14: }

15: }

A. 输出100 和 999.

B. 输出999 和 100.

C. 第2行出现编译错误,变量 maxElements未初始化.

D. 12行出现编译错误.

点击查看答案

第5题

java.awt.Graphics 类的哪个方法可绘制填充矩形?

A.fillRect()

B.drawRect()

C.fillOval()

D.drawPolygon()

E.drawLine()

点击查看答案

第6题

一个部件重绘时,方法调用按下面哪个次序?

A.直接调用 paint()

B.调用update ,而update会调用 paint()

C.调用repaint(),由它调用update(), update 再调用 paint()

D. 调用 repaint(),它将直接调用 paint

点击查看答案

第7题

所有变量初始化、对象创建、参数设置等可以安排在Applet的什么方法内完成.

A.init

B. start

C. stop

D. 以上都不是

点击查看答案

第8题

以下程序的运行结果为?class ValHold{public int i = 10;}public class ObParm{public static

以下程序的运行结果为?

class ValHold{

public int i = 10;

}

public class ObParm{

public static void main(String argv[]){

ObParm o = new ObParm();

o.amethod();

}

public void amethod(){

int i = 99;

ValHold v = new ValHold();

v.i=30;

another(v,i);

System.out.print( v.i );

}

public void another(ValHold v, int i){

i=0;

v.i = 20;

ValHold vh = new ValHold();

v = vh;

System.out.print(v.i);

System.out.print(i);

}

}

A.10030

B. 20030

C. 209930

D. 10020

点击查看答案

第9题

以下程序的编译和运行结果为?abstract class Base{abstract public void myfunc();public void

以下程序的编译和运行结果为?

abstract class Base{

abstract public void myfunc();

public void another(){

System.out.println("Another method");

}

}

public class Abs extends Base{

public static void main(String argv[]){

Abs a = new Abs();

A.amethod();

}

public void myfunc(){

System.out.println("My Func");

}

public void amethod(){

myfunc();

}

}

A.输出结果为 My Func

B.编译指示 Base 类中无抽象方法

C.编译通过,但运行时指示Base 类中无抽象方法

D.编译指示Base 类中的myfunc方法无方法体,没谁会喜欢该方法。

点击查看答案

第10题

要产生[20,999]之间的随机整数使用哪个表达式?

A.(int)(20+Math.random()*979)

B. 20+(int)(Math.random()*980)

C. (int)Math.random()*999

D. 20+(int)Math.random()*980

点击查看答案
热门考试 全部 >
相关试卷 全部 >
账号:
你好,尊敬的上学吧用户
发送账号至手机
获取验证码
发送
温馨提示
该问题答案仅针对搜题卡用户开放,请点击购买搜题卡。
马上购买搜题卡
我已购买搜题卡, 登录账号 继续查看答案
重置密码
确认修改
谢谢您的反馈

您认为本题答案有误,我们将认真、仔细核查,
如果您知道正确答案,欢迎您来纠错

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

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

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