lolipop12

OS Lab 1.3

Mar 21st, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.64 KB | None | 0 0
  1. import java.io.*;
  2.  
  3. public class HW01_3 {
  4.     public static void main(String[] args) throws IOException {
  5.         BufferedReader br=new BufferedReader(new FileReader("izvor.txt"));
  6.         StringBuilder st=new StringBuilder();
  7.         String line=br.readLine();
  8.         while(line!=null){
  9.             String [] niza=line.split(" ");
  10.           for(String b: niza){
  11.               st.append(b +" ");
  12.           }
  13.           line=br.readLine();
  14.  
  15.  
  16.         }
  17.         st.reverse();
  18.         PrintWriter pv=new PrintWriter(new FileOutputStream("destinacija.txt"));
  19.         pv.println(st.toString());
  20.         pv.flush();
  21.         pv.close();
  22.  
  23.     }
  24. }
Add Comment
Please, Sign In to add comment