【计算机类职业资格】二级JAVA机试-90及答案解析.doc

上传人:刘芸 文档编号:1326610 上传时间:2019-10-17 格式:DOC 页数:4 大小:30KB
下载 相关 举报
【计算机类职业资格】二级JAVA机试-90及答案解析.doc_第1页
第1页 / 共4页
【计算机类职业资格】二级JAVA机试-90及答案解析.doc_第2页
第2页 / 共4页
【计算机类职业资格】二级JAVA机试-90及答案解析.doc_第3页
第3页 / 共4页
【计算机类职业资格】二级JAVA机试-90及答案解析.doc_第4页
第4页 / 共4页
亲,该文档总共4页,全部预览完了,如果喜欢就下载吧!
资源描述

1、二级 JAVA 机试-90 及答案解析(总分:100.00,做题时间:90 分钟)一、1基本操作题(总题数:1,分数:33.00)1.下列 Application 程序中,指定 bCount 为 8 位整数类型,指定 sCount 为 16 位整数类型,指定 gNumber 为 64 位整数类型,给变量赋值并输出,请将程序补充完整。class test20_l public static void main(String args) _bCount=0x0F;_sCount=32767; int intCount=99999;_gNumber=Ox7FFFFFFFFFFFFFFFL;Syste

2、moutprintln(“byteCount =“+bCount); Systemoutprintln(“shortCount =“+sCount);Systemoutprintln(“fintCount =“+intCount);Systemoutprintln(“bigNumber =“+gNumber);(分数:33.00)填空项 1:_二、2简单应用题(总题数:1,分数:33.00)2.);(分数:33.00)_三、3综合应用题(总题数:1,分数:34.00)3.下面是一个 Applet 程序,其功能是有 2 个按钮,分别为 First 和 Second,以及一个 Labe1 构件。要

3、求点击 First 时则能在 Labe1 中显示出 Command:First,而点击 Second 时则能显示出 Command: Second,要求只能使用重载一次 actionPerformed( )方法。请改正程序中的错误(有下画线的语句),使程序能输出正确的结果。 注意:不改动程序的结构,不得增行或删行。import javaawt*; import javaawtevent*;import javaapplet*;/*applet code=ex20_3class width=800 height=400/applet*/public class ex20_3extends App

4、let implements ActionListener private String str=“Ok“;private Label 1;private Button btn;public void init() setLayout(null);1=new Label(str); 1reshape(10,10,100,30);add(1);btn=new Button(“First“);btnreshape(10,50,60,20);1addAcUonljstener(this);add(btn);btn=new Button(“Second“);btnreshape(10,100,60,2

5、0);btnsetActionCommand(“First“);btnaddAc“OnListener(this);add(btn);public void actionPerformed(ActionEvent ae) str=“Command:“+ae.getActionColllInttnd( );btnsetText(str);ex20_3.html HTMLHEADTITLEex20_3/TITLE/HEADBODY applet code=“ex20_3class“width=800 height=400 /applet/BODY/HTML(分数:34.00)_二级 JAVA 机试

6、90 答案解析(总分:100.00,做题时间:90 分钟)一、1基本操作题(总题数:1,分数:33.00)1.下列 Application 程序中,指定 bCount 为 8 位整数类型,指定 sCount 为 16 位整数类型,指定 gNumber 为 64 位整数类型,给变量赋值并输出,请将程序补充完整。class test20_l public static void main(String args) _bCount=0x0F;_sCount=32767; int intCount=99999;_gNumber=Ox7FFFFFFFFFFFFFFFL;Systemoutprintln

7、byteCount =“+bCount); Systemoutprintln(“shortCount =“+sCount);Systemoutprintln(“fintCount =“+intCount);Systemoutprintln(“bigNumber =“+gNumber);(分数:33.00)填空项 1:_ (正确答案:byte,short.long)解析:二、2简单应用题(总题数:1,分数:33.00)2.);(分数:33.00)_正确答案:(drawlmagegetlmageBtn)解析:三、3综合应用题(总题数:1,分数:34.00)3.下面是一个 Applet 程序,其

8、功能是有 2 个按钮,分别为 First 和 Second,以及一个 Labe1 构件。要求点击 First 时则能在 Labe1 中显示出 Command:First,而点击 Second 时则能显示出 Command: Second,要求只能使用重载一次 actionPerformed( )方法。请改正程序中的错误(有下画线的语句),使程序能输出正确的结果。 注意:不改动程序的结构,不得增行或删行。import javaawt*; import javaawtevent*;import javaapplet*;/*applet code=ex20_3class width=800 heig

9、ht=400/applet*/public class ex20_3extends Applet implements ActionListener private String str=“Ok“;private Label 1;private Button btn;public void init() setLayout(null);1=new Label(str); 1reshape(10,10,100,30);add(1);btn=new Button(“First“);btnreshape(10,50,60,20);1addAcUonljstener(this);add(btn);bt

10、n=new Button(“Second“);btnreshape(10,100,60,20);btnsetActionCommand(“First“);btnaddAc“OnListener(this);add(btn);public void actionPerformed(ActionEvent ae) str=“Command:“+ae.getActionColllInttnd( );btnsetText(str);ex20_3.html HTMLHEADTITLEex20_3/TITLE/HEADBODY applet code=“ex20_3class“width=800 height=400 /applet/BODY/HTML(分数:34.00)_正确答案:(btn.addActionListener(this)btn.btn.setActionCommand(“second“)1.sctTcxt(str)解析:

展开阅读全文
相关资源
猜你喜欢
  • ITU-T G 8032-2015 Ethernet ring protection switching (Study Group 15)《以太网环保护切换(研究组15)》.pdf ITU-T G 8032-2015 Ethernet ring protection switching (Study Group 15)《以太网环保护切换(研究组15)》.pdf
  • ITU-T G 804 FRENCH-2004 ATM cell mapping into plesiochronous digital hierarchy (PDH)《映射到准同步数字系列(PDH)的异步传输模式(ATM)信元 系列G 传输系统和媒体数字系统和网络 数字网络 一般性质 15号研究组》.pdf ITU-T G 804 FRENCH-2004 ATM cell mapping into plesiochronous digital hierarchy (PDH)《映射到准同步数字系列(PDH)的异步传输模式(ATM)信元 系列G 传输系统和媒体数字系统和网络 数字网络 一般性质 15号研究组》.pdf
  • ITU-T G 804 SPANISH-2004 ATM cell mapping into plesiochronous digital hierarchy (PDH)《映射到准同步数字系列(PDH)的异步传输模式(ATM)信元 系列G 传输系统和媒体数字系统和网络 数字网络 一般性质 15号研究组》.pdf ITU-T G 804 SPANISH-2004 ATM cell mapping into plesiochronous digital hierarchy (PDH)《映射到准同步数字系列(PDH)的异步传输模式(ATM)信元 系列G 传输系统和媒体数字系统和网络 数字网络 一般性质 15号研究组》.pdf
  • ITU-T G 804-2004 ATM cell mapping into plesiochronous digital hierarchy (PDH) SERIES G TRANSMISSION SYSTEMS AND MEDIA DIGITAL SYSTEMS AND NETWORKS Digital networks C General aspect.pdf ITU-T G 804-2004 ATM cell mapping into plesiochronous digital hierarchy (PDH) SERIES G TRANSMISSION SYSTEMS AND MEDIA DIGITAL SYSTEMS AND NETWORKS Digital networks C General aspect.pdf
  • ITU-T G 8040 FRENCH-2005 GFP frame mapping into Plesiochronous Digital Hierarchy (PDH)《准同步数字体系(PDH)的通用成帧规程(GFP)帧映射 也列为Y 1340》.pdf ITU-T G 8040 FRENCH-2005 GFP frame mapping into Plesiochronous Digital Hierarchy (PDH)《准同步数字体系(PDH)的通用成帧规程(GFP)帧映射 也列为Y 1340》.pdf
  • ITU-T G 8040 SPANISH-2005 GFP frame mapping into Plesiochronous Digital Hierarchy (PDH)《准同步数字体系(PDH)的通用成帧规程(GFP)帧映射 也列为Y 1340》.pdf ITU-T G 8040 SPANISH-2005 GFP frame mapping into Plesiochronous Digital Hierarchy (PDH)《准同步数字体系(PDH)的通用成帧规程(GFP)帧映射 也列为Y 1340》.pdf
  • ITU-T G 8040-2005 GFP frame mapping into Plesiochronous Digital Hierarchy (PDH) (Also Listed as Y 1340)《GFP帧映射到准同步数字序列(PDH)》.pdf ITU-T G 8040-2005 GFP frame mapping into Plesiochronous Digital Hierarchy (PDH) (Also Listed as Y 1340)《GFP帧映射到准同步数字序列(PDH)》.pdf
  • ITU-T G 805 FRENCH-2000 Generic functional architecture of transport networks《传输网的一般功能结构 系列G 传输系统和媒体数字系统和网络 数字网络 一般性质 13号研究组》.pdf ITU-T G 805 FRENCH-2000 Generic functional architecture of transport networks《传输网的一般功能结构 系列G 传输系统和媒体数字系统和网络 数字网络 一般性质 13号研究组》.pdf
  • ITU-T G 805 SPANISH-2000 Generic functional architecture of transport networks《传输网的一般功能结构 系列G 传输系统和媒体数字系统和网络 数字网络 一般性质 13号研究组》.pdf ITU-T G 805 SPANISH-2000 Generic functional architecture of transport networks《传输网的一般功能结构 系列G 传输系统和媒体数字系统和网络 数字网络 一般性质 13号研究组》.pdf
  • 相关搜索

    当前位置:首页 > 考试资料 > 职业资格

    copyright@ 2008-2019 麦多课文库(www.mydoc123.com)网站版权所有
    备案/许可证编号:苏ICP备17064731号-1