Advertisement
apl-mhd

FileRead

Dec 25th, 2017
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.62 KB | None | 0 0
  1. package file;
  2.  
  3. import java.io.*;
  4.  
  5. public class Main {
  6.  
  7.     public static void main(String[] args) throws IOException {
  8.  
  9.  
  10.         FileReader fr = new FileReader("a.txt");
  11.         BufferedReader br=new BufferedReader(fr);
  12.         FileWriter fw = new FileWriter("b.txt");
  13.         BufferedWriter bw=new BufferedWriter(fw);
  14.         String s=br.readLine();
  15.         while(s!=null)
  16.         {
  17.  
  18.             bw.write(s+"\n");
  19.            // if(s==null) break;
  20.              s=br.readLine();
  21.             //s=s+"\n";
  22.  
  23.         }
  24.         br.close();
  25.         fr.close();
  26.  
  27.         bw.close();
  28.         fw.close();
  29.     }
  30.  
  31.  
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement