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

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

1、二级 JAVA 机试 57 及答案解析(总分:100.00,做题时间:90 分钟)一、B1基本操作题/B(总题数:1,分数:30.00)1.下面的程序是打印输出 100300 之间的不能被 3 整除的数。请在每条横线处填写一条语句,使程序的功能完整。 注意:请勿改动 main()主方法和其他已有的语句内容,仅在横线处填人适当的语句。 public class printNo3and5 void print() int n ; for(n=100 ;n0) _; _; b=r; 1setText(“最大公约数:“+Integer.toString(a); catch(NumberFormatEx

2、ception nfe) 1setText(“请正确输入!“); (分数:40.00)_三、B3综合应用题/B(总题数:1,分数:30.00)3.下面是一个 Applet 程序,其功能是建立一个图形用户界面的窗口,包括一个文本显示区和一个按钮,点击按钮,可以声文本区已有的文本基础上追加显示 10 条“Welcome to China!”信息,并且文本区由滚动条控制文本的上下滚动。请改正程序中的错误(有下画线的语句),使程序能输出正确的结果。注意:不改动程序的结构,不得增行或删行。import javax.swing.*;import java.awt.*;import java.awt.eve

3、nt.*;/*applet code=“exl3_4.class“width=800 height=400/applet*/public class exl4_3 extends JAppletJButton jb=new JButton(“Add Text“);JTextPane jtp=new JTextPane();public void init()jb.addActionListener(new Ac60nListener()pubhc void actionPerformed(ActionEvent e)for(int i=1;i0) _; _; b=r; 1setText(“最大

4、公约数:“+Integer.toString(a); catch(NumberFormatException nfe) 1setText(“请正确输入!“); (分数:40.00)_正确答案:()解析:r=a%b a=b三、B3综合应用题/B(总题数:1,分数:30.00)3.下面是一个 Applet 程序,其功能是建立一个图形用户界面的窗口,包括一个文本显示区和一个按钮,点击按钮,可以声文本区已有的文本基础上追加显示 10 条“Welcome to China!”信息,并且文本区由滚动条控制文本的上下滚动。请改正程序中的错误(有下画线的语句),使程序能输出正确的结果。注意:不改动程序的结构,

5、不得增行或删行。import javax.swing.*;import java.awt.*;import java.awt.event.*;/*applet code=“exl3_4.class“width=800 height=400/applet*/public class exl4_3 extends JAppletJButton jb=new JButton(“Add Text“);JTextPane jtp=new JTextPane();public void init()jb.addActionListener(new Ac60nListener()pubhc void act

6、ionPerformed(ActionEvent e)for(int i=1;i10;i+)Ujtp.geText(jtp.setText()+“Welcome to China! /n“);/U);Container cp=getContentPane();cp.add(new JScrollPane(jtp);cp.add(BorderLayout.SOUTH,jtp);public static void main(Stdng args)ex14_3 obj14_3=new ex14_3();String str=obj14_3.getClass().toString();if(str.

7、indexOf(“class“)!=-1)str=str.substring(6);JFrame frm=new JFrame(str);frm.addWindowListener(new WindowAdapter()pubhc void windowClosing(WindowEvent we)System.exit(0););frm.getContentPane().add(ex3_10);frm.setSize(300,400);frm.setVisible(true);ex14_3.htmlHTMIHEADTITLEex14_3/HEADBODYapplet code=“ex14_3.class“width=800 height=400/applet/BODY/HTML(分数:30.00)_正确答案:()解析:setText(jtp.getText() +“Welcome to China! /n“) cp.add(BorderLayout.SOUTH,jb) frm.getContentPane().add(obj14_3)

展开阅读全文
相关资源
猜你喜欢
  • DIN EN ISO 19901-6-2012 Petroleum and natural gas industries - Specific requirements for offshore structures - Part 6 Marine operations (ISO 19901-6 2009 + Cor 1 2011) English vers.pdf DIN EN ISO 19901-6-2012 Petroleum and natural gas industries - Specific requirements for offshore structures - Part 6 Marine operations (ISO 19901-6 2009 + Cor 1 2011) English vers.pdf
  • DIN EN ISO 19901-7-2013 Petroleum and natural gas industries - Specific requirements for offshore structures - Part 7 Stationkeeping systems for floating offshore structures and mo.pdf DIN EN ISO 19901-7-2013 Petroleum and natural gas industries - Specific requirements for offshore structures - Part 7 Stationkeeping systems for floating offshore structures and mo.pdf
  • DIN EN ISO 19901-8-2015 Petroleum and natural gas industries - Specific requirements for offshore structures - Part 8 Marine soil investigations (ISO 19901-8 2014) English version .pdf DIN EN ISO 19901-8-2015 Petroleum and natural gas industries - Specific requirements for offshore structures - Part 8 Marine soil investigations (ISO 19901-8 2014) English version .pdf
  • DIN EN ISO 19902-2014 Petroleum and natural gas industries - Fixed steel offshore structures (ISO 19902 2007 + Amd 1 2013) English version EN ISO 19902 2007 + A1 2013 only on CD-RO.pdf DIN EN ISO 19902-2014 Petroleum and natural gas industries - Fixed steel offshore structures (ISO 19902 2007 + Amd 1 2013) English version EN ISO 19902 2007 + A1 2013 only on CD-RO.pdf
  • DIN EN ISO 19903-2007 Petroleum and natural gas industries - Fixed concrete offshore structures (ISO 19903 2006) English version EN ISO 19903 2006《石油和天然气工业 固定混凝土海上平台》.pdf DIN EN ISO 19903-2007 Petroleum and natural gas industries - Fixed concrete offshore structures (ISO 19903 2006) English version EN ISO 19903 2006《石油和天然气工业 固定混凝土海上平台》.pdf
  • DIN EN ISO 19904-1-2007 Petroleum and natural gas industries - Floating offshore structures - Part 1 Monohulls semi-submersibles and spars (ISO 19904-1 2006) English version EN ISO.pdf DIN EN ISO 19904-1-2007 Petroleum and natural gas industries - Floating offshore structures - Part 1 Monohulls semi-submersibles and spars (ISO 19904-1 2006) English version EN ISO.pdf
  • DIN EN ISO 19905-1-2016 Petroleum and natural gas industries - Site-specific assessment of mobile offshore units - Part 1 Jack-ups (ISO 19905-1 2016) English version EN ISO 19905-1.pdf DIN EN ISO 19905-1-2016 Petroleum and natural gas industries - Site-specific assessment of mobile offshore units - Part 1 Jack-ups (ISO 19905-1 2016) English version EN ISO 19905-1.pdf
  • DIN EN ISO 19906-2011 Petroleum and natural gas industries - Arctic offshore structures (ISO 19906 2010) English version EN ISO 19906 2010 only on CD-ROM《石油和天然气工业 北极的海上建筑物(ISO 1990.pdf DIN EN ISO 19906-2011 Petroleum and natural gas industries - Arctic offshore structures (ISO 19906 2010) English version EN ISO 19906 2010 only on CD-ROM《石油和天然气工业 北极的海上建筑物(ISO 1990.pdf
  • DIN EN ISO 19932-1-2013 Equipment for crop protection - Knapsack sprayers - Part 1 Safety and environmental requirements (ISO 19932-1 2013) German version EN 19932-1 2013《作物保护设备 背负.pdf DIN EN ISO 19932-1-2013 Equipment for crop protection - Knapsack sprayers - Part 1 Safety and environmental requirements (ISO 19932-1 2013) German version EN 19932-1 2013《作物保护设备 背负.pdf
  • 相关搜索

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

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