import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintWriter; public class IOTest {
public static void main(String[] args) {
PrintWriter pw;
try {
pw = new PrintWriter("C:\\temp\\printwrite.txt");
pw.println("hello test");
pw.println("this is holiday");
pw.close();
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} FileReader fileReader;
BufferedReader bufferedReader;
try {
fileReader = new FileReader("C:\\temp\\test.txt");
bufferedReader = new BufferedReader(fileReader); System.out.println(bufferedReader.readLine());
System.out.println(bufferedReader.readLine()); bufferedReader.close(); } catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} }
}
05-11 21:53