Wednesday, May 5, 2010

Жава - Файлаас унших 2

\\ Илүү хялбар жишээ, файлын нэр UseBufferedReader.java

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

public class UseBufferedReader {

public static void main(String[] args) {

try {

String sCurrentLine;

BufferedReader br =
new BufferedReader(new FileReader("C:\\readFile.txt"));

while ((sCurrentLine = br.readLine()) != null) {
System.out.println(sCurrentLine);
}

} catch (FileNotFoundException e) {

e.printStackTrace();

} catch (IOException e) {

e.printStackTrace();

}

}
}
ЭХ КОДЫГ ТАТАХ

No comments:

Post a Comment