Source code
package com.t4b.test;
import java.io.FileReader;
public class FileReaderTest {
public static void main(String[] args) {
try {
FileReader fr = new FileReader("test.txt");
int i;
while ((i = fr.read()) != -1)
System.out.print((char) i);
fr.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
Source code
package com.t4b.test;
import java.io.FileWriter;
public class FileWriterTest {
public static void main(String[] args) {
try {
FileWriter fw = new FileWriter("test.txt");
fw.write("Hello World!");
fw.close();
} catch (Exception e) {
System.out.println(e);
}
}
}
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.