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