第一范文网 - 专业文章范例文档资料分享平台

1609第一次月考详细解析

来源:用户分享 时间:2025/5/23 16:16:49 本文由loading 分享 下载这篇文档手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:xxxxxxx或QQ:xxxxxx 处理(尽可能给您提供完整文档),感谢您的支持与谅解。

B.break即可以出现在循环语句中也可以出现在switch语句中 C.continue可以用于跳出循环 D.continue不能出现在switch语句中 正确答案:C

break”语句用来结束循环,即不再执行后边的所有循环。

“continue”语句用来结束当前循环,并进入下一次循环,即仅仅这一次循环结束了,不是所有循环结束了,后边的循环依旧进行。

34.

(单选)请看下列代码编译和运行的结果是: package packagea; public class Message {

String getText() { return \package packageb;

public class XMLMessage extends packagea.Message{ String getText() {

return \

public static void main(String[] args) {

System.out.println(new XMLMessage().getText()); } }直接new对象了 A.text

B.text C.抛出运行时异常

D.代码public class XMLMessage extends packagea.Message{行,编译错误 正确答案:B

这题中XMLMessage继承Message是一个幌子,在println方法中我们new出来得是XMLMessage对象,直接调用XMLMessage的getText方法

35.

(单选)程序执行的结果是()。 public class Test { String name=\public Test(String name){

this.name=name; }//没有this

public static void main(String [] args){ Test t = new Test(\

System.out.println(t.name); } }//直接访问成员变量 A.null B.Tom C.Jack D.\正确答案:B 36.

(单选)请看下列代码的输出结果是: public class Bootchy { int bootch;

String snootch;

public Bootchy() { 构造方法的重载 this(\ 第一先进来这里 System.out.print(\最后输出 }

public Bootchy(String snootch) { this(420, \第二进这里

System.out.print(\其次输出 }

public Bootchy(int bootch, String snootch) { this.bootch = bootch; 第三进这里 this.snootch = snootch;

System.out.print(\首先输出 }

public static void main(String[] args) { Bootchy b = new Bootchy();

System.out.print(b.snootch + \ A.first second third snootchy 420 B.third second first snootchy 420 C.third first second snootchy 420

D.first second first third snootchy 420 正确答案:B

37.(单选)下列代码的输出结果是:()。 public class StaticFoo { int num;

static int x;

public static void main(String[] args) { StaticFoo foo1 = new StaticFoo (); foo1.num++; foo1.x++;

StaticFoo foo2 = new StaticFoo (); foo2.num++; foo2.x++;

StaticFoo foo3 = new StaticFoo (); foo3.num++; foo3.x++; StaticFoo.x++;

搜索更多关于: 1609第一次月考详细解析 的文档
1609第一次月考详细解析.doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.diyifanwen.net/c867rq0rzzt6trx01723y3gzju6vsv000dft_6.html(转载请注明文章来源)
热门推荐
Copyright © 2012-2023 第一范文网 版权所有 免责声明 | 联系我们
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:xxxxxx 邮箱:xxxxxx@qq.com
渝ICP备2023013149号
Top