位置: 首页 > IT认证 > JAVA认证

2016年Java考试精选程序阅读题

2016-11-07 JAVA认证

  1.写出以下程序的运行结果。

class First {

First(  ) {

tln ("in First"); } }

public class Second extends First { Second(  ) {

tln("in Second"); } public static void main(String[] args) { Second mine= new Second(  ); } }

程序运行的结果:

in First in Second

  2.解释程序中语句的'含义

文本文件中的内容是 abcd

下面的程序将文件中的内容写到文件中和屏幕上 import .*;

public class filecopy {

public static void main(String[] args) { try {

StringBuffer str=new StringBuffer(  );

FileInputStream fin=new FileInputStream("");

意义

FileOutputStream fout=new FileOutputStream("");

意义

int c;

while((c=(  ))!=-1) {

e(c); 意义

nd((char)c); 意义

}

e(  ); e(  );

String str2=ring(  );

tln(str2); 显示的结果是

}catch(Exception c) {

tln(c); } } }

实例化输入流对象,指定输入流来源文件为 实例化输出流对象,指定输出流目标文件为 将C写入到输出流对象中

将整数C转化为字符,并添加到字符串str的尾部 abcd

标签:JAVA 考试 精选 阅读
2016-10-24
2016-11-14
2016-08-01
2017-12-13
2016-06-19
2016-09-08
2017-12-13
2019-09-19
2016-11-07
2016-06-19

Copyright ©2024 才华斋 All Rights Reserved.