【计算机类职业资格】计算机二级JAVA-172 (1)及答案解析.doc

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

1、计算机二级 JAVA-172 (1)及答案解析(总分:100.00,做题时间:90 分钟)一、综合应用题(总题数:3,分数:100.00)1.本程序的功能是监听对菜单项和工具条的操作。窗口中有“Color”菜单和一个工具条,“Color”菜单中包括“Yellow”、“Blue”、“Red”和“Exit”菜单项,每个菜单项都有对应的图形,单击前三个颜色菜单项,主窗口就变成对应的颜色,单击“Exit”菜单项则退出程序。工具条上则有四个按钮,分别为三个颜色按钮和一个退出程序的按钮,单击任意一个颜色按钮,主窗口将变成按钮对应的颜色,单击退出程序按钮,则退出程序,如图所示。 (分数:33.00)_2.本

2、程序是一个 Applet,功能是在页面上画比例柱状图。页面中展示了 1998 年 9 个国家的人口数,并以柱状图的方式对各国人口数的多少做了对比,如图所示。 (分数:33.00)_3.本程序的功能是打印出程序所在磁盘下所有目录,方法是将当前目录下的所有目录压入栈,然后弹出一个目录,将该目录下所有的目录压入栈,直到栈空。 import java.io.*; import java.util.*; public class exam_25 public static void main(String args) Stack directoryStack=new Stack(); File root

3、new File(File.separator + “.“); directoryStack.push(root); while ( directoryStack.length() 0 ) File currentDirectory=(File)directoryStack.pop(); System.out.println(currentDirectory); String subdirectories=currentDirectory.list() ; if (subdirectories != null) for (int i=0; i subdirectories.length; i

4、) try String fname =currentDirectory.getCanonicalPath() + File.separator + subdirectoriesi; File f=new File(fname); if (f.isDirectory() directoryStack.pop(f) ; catch(IOException e) System.out.println(e); (分数:34.00)_计算机二级 JAVA-172 (1)答案解析(总分:100.00,做题时间:90 分钟)一、综合应用题(总题数:3,分数:100.00)1.本程序的功能是监听对菜单项和

5、工具条的操作。窗口中有“Color”菜单和一个工具条,“Color”菜单中包括“Yellow”、“Blue”、“Red”和“Exit”菜单项,每个菜单项都有对应的图形,单击前三个颜色菜单项,主窗口就变成对应的颜色,单击“Exit”菜单项则退出程序。工具条上则有四个按钮,分别为三个颜色按钮和一个退出程序的按钮,单击任意一个颜色按钮,主窗口将变成按钮对应的颜色,单击退出程序按钮,则退出程序,如图所示。 (分数:33.00)_正确答案:()解析:第 1 处:contentPane.add(bar, BorderLayout.NORTH) 第 2 处:setJMenuBar(menuBar) 第 3

6、处:panel.setBackground(c)2.本程序是一个 Applet,功能是在页面上画比例柱状图。页面中展示了 1998 年 9 个国家的人口数,并以柱状图的方式对各国人口数的多少做了对比,如图所示。 (分数:33.00)_正确答案:()解析:第 1 处:valuesi = Double.parseDouble 第 2 处:super.paintComponent(g) 第 3 处:Graphics2D g2 = (Graphics2D)g3.本程序的功能是打印出程序所在磁盘下所有目录,方法是将当前目录下的所有目录压入栈,然后弹出一个目录,将该目录下所有的目录压入栈,直到栈空。 im

7、port java.io.*; import java.util.*; public class exam_25 public static void main(String args) Stack directoryStack=new Stack(); File root=new File(File.separator + “.“); directoryStack.push(root); while ( directoryStack.length() 0 ) File currentDirectory=(File)directoryStack.pop(); System.out.printl

8、n(currentDirectory); String subdirectories=currentDirectory.list() ; if (subdirectories != null) for (int i=0; i subdirectories.length; i+) try String fname =currentDirectory.getCanonicalPath() + File.separator + subdirectoriesi; File f=new File(fname); if (f.isDirectory() directoryStack.pop(f) ; catch(IOException e) System.out.println(e); (分数:34.00)_正确答案:()解析:第 1 处:directoryStack.size() 0 第 2 处:String subdirectories = currentDirectory.list() 第 3 处:directoryStack.push(f)

展开阅读全文
相关资源
猜你喜欢
  • DIN EN 12119-1997 Plastics piping systems - Polyethylene (PE) valves - Test method for resistance to thermal cycling German version EN 12119 1997《塑料管道系统 聚乙烯(PE)管 耐温度循环试验方法》.pdf DIN EN 12119-1997 Plastics piping systems - Polyethylene (PE) valves - Test method for resistance to thermal cycling German version EN 12119 1997《塑料管道系统 聚乙烯(PE)管 耐温度循环试验方法》.pdf
  • DIN EN 1212-2005 Chemicals used for treatment of water intended for human consumption - Sodium polyphosphate German version EN 1212 2005《人类生活用水处理用化学制品 聚磷酸钠》.pdf DIN EN 1212-2005 Chemicals used for treatment of water intended for human consumption - Sodium polyphosphate German version EN 1212 2005《人类生活用水处理用化学制品 聚磷酸钠》.pdf
  • DIN EN 12120-2013 Chemicals used for treatment of water intended for human consumption Sodium hydrogen sulfite German version EN 12120 2012《人类生活用水处理用化学品 亚硫酸氢钠 德文版本EN 12120-2012》.pdf DIN EN 12120-2013 Chemicals used for treatment of water intended for human consumption Sodium hydrogen sulfite German version EN 12120 2012《人类生活用水处理用化学品 亚硫酸氢钠 德文版本EN 12120-2012》.pdf
  • DIN EN 12121-2013 Chemicals used for treatment of water intended for human consumption Sodium disulfite German version EN 12121 2012《人类用水处理用化学品 二硫化钠 德文版本EN 12121-2012》.pdf DIN EN 12121-2013 Chemicals used for treatment of water intended for human consumption Sodium disulfite German version EN 12121 2012《人类用水处理用化学品 二硫化钠 德文版本EN 12121-2012》.pdf
  • DIN EN 12122-2005 Chemicals used for treatment of water intended for human consumption - Ammonia solution German version EN 12122 2005《人类用水处理用化学制品 氨溶液》.pdf DIN EN 12122-2005 Chemicals used for treatment of water intended for human consumption - Ammonia solution German version EN 12122 2005《人类用水处理用化学制品 氨溶液》.pdf
  • DIN EN 12123-2013 Chemicals used for treatment of water intended for human consumption Ammonium sulfate German version EN 12123 2012《人类生活用水处理用化学品 硫酸胺 德文版本EN 12123-2012》.pdf DIN EN 12123-2013 Chemicals used for treatment of water intended for human consumption Ammonium sulfate German version EN 12123 2012《人类生活用水处理用化学品 硫酸胺 德文版本EN 12123-2012》.pdf
  • DIN EN 12124-2013 Chemicals used for treatment of water intended for human consumption Sodium sulfite German version EN 12124 2012《人类生活用水处理用化学品 亚硫酸钠 德文版本EN 12124-2012》.pdf DIN EN 12124-2013 Chemicals used for treatment of water intended for human consumption Sodium sulfite German version EN 12124 2012《人类生活用水处理用化学品 亚硫酸钠 德文版本EN 12124-2012》.pdf
  • DIN EN 12125-2013 Chemicals used for treatment of water intended for human consumption Sodium thiosulfate German version EN 12125 2012《人类生活用水处理用化学品 硫代硫酸钠 德文版本EN 12125-2012》.pdf DIN EN 12125-2013 Chemicals used for treatment of water intended for human consumption Sodium thiosulfate German version EN 12125 2012《人类生活用水处理用化学品 硫代硫酸钠 德文版本EN 12125-2012》.pdf
  • DIN EN 12126-2013 Chemicals used for treatment of water intended for human consumption Liquefied ammonia German version EN 12126 2012《人类生活用水处理用化学品 液氨 德文版本EN 12126-2012》.pdf DIN EN 12126-2013 Chemicals used for treatment of water intended for human consumption Liquefied ammonia German version EN 12126 2012《人类生活用水处理用化学品 液氨 德文版本EN 12126-2012》.pdf
  • 相关搜索

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

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