Problem1192--Java 文件操作示例

1192: Java 文件操作示例

Time Limit: 1 Sec  Memory Limit: 128 MB
Submit: 1  Solved: 1
[Submit] [Status] [Web Board] [Creator:]

Description

代码如下:

import java.io.*;
 
public class Java_1 {
 
    public static void main(String[] args) {
        char[] charArray = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i'};
        char c;
        try {
            //*********Found********** 
            DataOutputStream out = new ______________________(
                    new FileOutputStream("test.dat"));
            for (int i = 0; i < charArray.length; i++) {
                out.writeChar(charArray[i]);
            }
            out.close();
            DataInputStream in = new DataInputStream(
                    //*********Found********** 
                    new FileInputStream("____________________"));
            while (in.available() != 0) {
                c = in.readChar();
                System.out.print(c + " ");
            }
            System.out.println();
            //*********Found********** 
            in.____________________();
        } catch (IOException e) {
        }
    }
}

Source/Category