[计算机类试卷]国家二级(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)

展开阅读全文
相关资源
猜你喜欢
  • BS ISO 8605-2001 Textile-glass-reinforced plastics - Sheet moulding compound (SMC) - Basis for specification《玻璃纤维增强塑料 片状模塑料(SMC) 规格依据》.pdf BS ISO 8605-2001 Textile-glass-reinforced plastics - Sheet moulding compound (SMC) - Basis for specification《玻璃纤维增强塑料 片状模塑料(SMC) 规格依据》.pdf
  • BS ISO 8608-2016 Mechanical vibration Road surface profiles Reporting of measured data《机械振动 路面纵断面 测量数据的报告》.pdf BS ISO 8608-2016 Mechanical vibration Road surface profiles Reporting of measured data《机械振动 路面纵断面 测量数据的报告》.pdf
  • BS ISO 8622-1998 Cinematography - Magnetic sound records on 70 mm motion-picture release prints with magnetic stripes - A-chain reproduction characteristics《电影技术 磁带声迹70mm电.pdf BS ISO 8622-1998 Cinematography - Magnetic sound records on 70 mm motion-picture release prints with magnetic stripes - A-chain reproduction characteristics《电影技术 磁带声迹70mm电.pdf
  • BS ISO 8625-4-2011 Aerospace Fluid systems Vocabulary General terms and definitions relating to control actuation systems《航空航天 液体系统 词汇 和控制 驱动系统相关的一般术语和定义》.pdf BS ISO 8625-4-2011 Aerospace Fluid systems Vocabulary General terms and definitions relating to control actuation systems《航空航天 液体系统 词汇 和控制 驱动系统相关的一般术语和定义》.pdf
  • BS ISO 8636-2-2008 Machine tools - Test conditions for bridge-type milling machines - Testing of the accuracy - Travelling bridge (gantry-type) machines《机床 桥式铣床的试验条件 精度测试.pdf BS ISO 8636-2-2008 Machine tools - Test conditions for bridge-type milling machines - Testing of the accuracy - Travelling bridge (gantry-type) machines《机床 桥式铣床的试验条件 精度测试.pdf
  • BS ISO 8639-2016 Glass-reinforced thermosetting plastics (GRP) pipes and fittings Test methods for leaktightness and proof of structural design of flexible joints《玻璃增强热固性塑.pdf BS ISO 8639-2016 Glass-reinforced thermosetting plastics (GRP) pipes and fittings Test methods for leaktightness and proof of structural design of flexible joints《玻璃增强热固性塑.pdf
  • BS ISO 8640-1-2004 Textile machinery and accessories - Flat warp knitting machines - Vocabulary of basic structure and knitting elements《纺织机械与附件 平经编机 基础结构和编织机件的词汇》.pdf BS ISO 8640-1-2004 Textile machinery and accessories - Flat warp knitting machines - Vocabulary of basic structure and knitting elements《纺织机械与附件 平经编机 基础结构和编织机件的词汇》.pdf
  • BS ISO 8640-2-2004 Textile machinery and accessories - Flat warp knitting machines - Vocabulary of warp let-off fabric take-up and batching《纺织机械与附件 平经编机 送经、织物卷取和卷布词汇》.pdf BS ISO 8640-2-2004 Textile machinery and accessories - Flat warp knitting machines - Vocabulary of warp let-off fabric take-up and batching《纺织机械与附件 平经编机 送经、织物卷取和卷布词汇》.pdf
  • BS ISO 8640-3-2002 Textile machinery and accessories - Flat warp knitting machines - Vocabulary - Vocabulary of patterning devices《纺织机械和附件 平经针织机 词汇 提花装置词汇》.pdf BS ISO 8640-3-2002 Textile machinery and accessories - Flat warp knitting machines - Vocabulary - Vocabulary of patterning devices《纺织机械和附件 平经针织机 词汇 提花装置词汇》.pdf
  • 相关搜索

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

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