当前位置:才华咖 > 互联网计算机 > IT认证 > JAVA认证 > 2016年Java考试精选程序阅读题
手机版

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

来源:才华咖 阅读:2.82W 次

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

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

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

本文链接:https://www.caihuaka.com/itrz/java/2odoyy.html

Copyright © 2024. 才华咖 All right reserved. 浙ICP备20120231号-3

文字美图素材,版权属于原作者。部分文章内容由网友提供推送时因种种原因未能与原作者联系上,若涉及版权问题,敬请原作者联系我们,立即处理。