Thursday, April 22, 2010

ต้องการ write ลง file อย่าง ง่ายๆ

// PrintFile.java

import java.io.*;

class PrintFile {

    public static void main(String args[]) {

        PrintWriter pw = null;

        try {

            pw = new PrintWriter("tmp");

        } catch(FileNotFoundException e) {

            System.err.println(e);

        }

        pw.println("Hello! how do you do?");

        pw.close();

    }

}

No comments:

Post a Comment