SHARE
TWEET
Untitled
a guest
Jan 13th, 2017
51
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- public class Main {
- private static final String FILENAME = "D:\\data.txt";
- public static void main(String[] args) {
- String text = new String();
- readFile(FILENAME);
- }
- public static void readFile (String FILENAME) {
- String sCurrentLine;
- BufferedReader br = null;
- FileReader fr = null;
- try {
- fr = new FileReader(FILENAME);
- br = new BufferedReader(fr);
- while ((sCurrentLine = br.readLine()) != null) {
- changeFile(sCurrentLine);
- }
- } catch (IOException e) {
- e.printStackTrace();
- } finally {
- try {
- if (br != null)
- br.close();
- if (fr != null)
- fr.close();
- } catch (IOException ex) {
- ex.printStackTrace();
- }
- }
- }
- public static void changeFile (String FILENAME) {
- String text = "";
- if (text != null) {
- text = text + FILENAME;
- }
- System.out.println(text);
- }
- }
RAW Paste Data


