[计算机类试卷]国家二级(JAVA)机试模拟试卷25及答案与解析.doc

上传人:Iclinic170 文档编号:503556 上传时间:2018-11-29 格式:DOC 页数:4 大小:29.50KB
下载 相关 举报
[计算机类试卷]国家二级(JAVA)机试模拟试卷25及答案与解析.doc_第1页
第1页 / 共4页
[计算机类试卷]国家二级(JAVA)机试模拟试卷25及答案与解析.doc_第2页
第2页 / 共4页
[计算机类试卷]国家二级(JAVA)机试模拟试卷25及答案与解析.doc_第3页
第3页 / 共4页
[计算机类试卷]国家二级(JAVA)机试模拟试卷25及答案与解析.doc_第4页
第4页 / 共4页
亲,该文档总共4页,全部预览完了,如果喜欢就下载吧!
资源描述

1、国家二级( JAVA)机试模拟试卷 25及答案与解析 一、基本操作题( 30分) 1 请在每条横线处填写一个语句,使程序的功能完整,且输出结果为 911。 注意:请勿改动 main()主方法和其他已有的语句内容,仅在横线处填入适当的语句。 public class Outer public static void main(String args) Outer i=new Outer(); i.taskInner(); public class lnner private int size; public void doSomething(int size) _/访问局部变量 this.siz

2、e+; /访问内部类的成员变量 _/访问外部类的成员变量 System.out.println(size+“ “+this.size+“ “+Outer.this.size); public void tasklnner() _ k.doSomething(8); private static int size; 二、简单应用题( 40分) 2 请 完成下列 Java程序。程序的功能是复制文件并显示文件,将每个字符读入,并写入另一个文件,同时显示出来 (注意:在本题中,当前目录下的 README.txt文件打印在屏幕上,并写入另一个文件 temp.txt中 )。 注意:请勿改动 main()主

3、方法和其他已有的语句内容,仅在下画线处填人适当的语句。 import java.io.*; public class FileCopyBy public static void main(String args) try FileReader input=new FileReader(“README.txt“); FileWriter output=new FileWriter(“temp.txt“); int c=input.read(); while(_) _ System.out.print(char)c); c=input.read(); input.close(); output.c

4、lose(); catch(IOException e) System out println(e); 三、综合应用题( 30分) 3 下面是一个 Applet程序,其功能是用一组坐标点绘制一个多边形,并通过沿坐标的垂直方向移动,把它移到窗口的下半部分,然后填充它。请改正程序中的错误(有下画线的语句 ),使程序能输出正确的结果。 注意:不改动程序的结构,不得增行或删行。 import java.awt.*; import java.applet.*; /* applet code=“ex16_3.class“width=800 height=400 /applet */ public clas

5、s ex16_3 extends Applet int x=15,50,100,160,120,190; int y=15,100,30,15,80,50 ; public void init() setBackground(Color.lightGray); pubUc void paint(Craphics g) inty2=new int6; g.setColor(Color.red); Rectangle rect=getBounds(); g.drawPolygon(x,y2,6); for(int i=0;i 6;i+) Y2i=yi+(rect.height/2); g.fill

6、Polygon(x,y,6); ex16_3.html HTML HEAD TITLE ex16_3 /TITLE /HEAD BODY applet code=ex16_3.class“width=800 height=400 /applet /BODY /HTML 国家二级( JAVA)机试模拟试卷 25答案与解析 一、基本操作题( 30分) 1 【正确答案】 size+; Outer.this.size+; Inner k=new lnner(); 二、简单应用题( 40分) 2 【正确答案】 c! = -1 output.write(c); 三、综合应用题( 30分) 3 【正确答案】 drawPolygon(x,y,6) y2i+=yi+(rect.height/2) g.fllPolygon(x,y2,6)

展开阅读全文
相关资源
猜你喜欢
  • ASTM C1481-2012 Standard Guide for Use of Joint Sealants with Exterior Insulation and Finish Systems (EIFS)《外部绝缘和精整系统(EIFS)用密接剂使用的标准指南》.pdf ASTM C1481-2012 Standard Guide for Use of Joint Sealants with Exterior Insulation and Finish Systems (EIFS)《外部绝缘和精整系统(EIFS)用密接剂使用的标准指南》.pdf
  • ASTM C1481-2012(2017) Standard Guide for Use of Joint Sealants with Exterior Insulation and Finish Systems (EIFS)《外部绝缘和精整系统用密接剂使用的标准指南》.pdf ASTM C1481-2012(2017) Standard Guide for Use of Joint Sealants with Exterior Insulation and Finish Systems (EIFS)《外部绝缘和精整系统用密接剂使用的标准指南》.pdf
  • ASTM C1482-2004 Standard Specification for Polyimide Flexible Cellular Thermal and Sound Absorbing Insulation《聚酰亚胺柔性多孔隔热和隔声材料标准规范》.pdf ASTM C1482-2004 Standard Specification for Polyimide Flexible Cellular Thermal and Sound Absorbing Insulation《聚酰亚胺柔性多孔隔热和隔声材料标准规范》.pdf
  • ASTM C1482-2008 Standard Specification for Polyimide Flexible Cellular Thermal and Sound Absorbing Insulation.pdf ASTM C1482-2008 Standard Specification for Polyimide Flexible Cellular Thermal and Sound Absorbing Insulation.pdf
  • ASTM C1482-2009 Standard Specification for Polyimide Flexible Cellular Thermal and Sound Absorbing Insulation《聚酰亚胺柔性多孔吸热和吸声绝缘件的标准规范》.pdf ASTM C1482-2009 Standard Specification for Polyimide Flexible Cellular Thermal and Sound Absorbing Insulation《聚酰亚胺柔性多孔吸热和吸声绝缘件的标准规范》.pdf
  • ASTM C1482-2010 Standard Specification for Polyimide Flexible Cellular Thermal and Sound Absorbing Insulation《聚酰亚胺柔性多孔隔热和吸声材料标准规范》.pdf ASTM C1482-2010 Standard Specification for Polyimide Flexible Cellular Thermal and Sound Absorbing Insulation《聚酰亚胺柔性多孔隔热和吸声材料标准规范》.pdf
  • ASTM C1482-2011 Standard Specification for Polyimide Flexible Cellular Thermal and Sound Absorbing Insulation《聚酰亚胺柔性多孔保温及吸声绝缘的标准规格》.pdf ASTM C1482-2011 Standard Specification for Polyimide Flexible Cellular Thermal and Sound Absorbing Insulation《聚酰亚胺柔性多孔保温及吸声绝缘的标准规格》.pdf
  • ASTM C1482-2012 Standard Specification for Polyimide Flexible Cellular Thermal and Sound Absorbing Insulation《聚酰亚胺柔性多孔隔热和吸声绝缘材料的标准规格》.pdf ASTM C1482-2012 Standard Specification for Polyimide Flexible Cellular Thermal and Sound Absorbing Insulation《聚酰亚胺柔性多孔隔热和吸声绝缘材料的标准规格》.pdf
  • ASTM C1482-2017 Standard Specification for Polyimide Flexible Cellular Thermal and Sound Absorbing Insulation《聚酰亚胺柔性多孔隔热和吸声材料的标准规格》.pdf ASTM C1482-2017 Standard Specification for Polyimide Flexible Cellular Thermal and Sound Absorbing Insulation《聚酰亚胺柔性多孔隔热和吸声材料的标准规格》.pdf
  • 相关搜索

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

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