Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #OS LAB1/3 made by Fensa08
- import java.io.*;
- public class HW01_3 {
- public static void main(String args[]) throws IOException {
- BufferedReader in = null;
- BufferedWriter out = null;
- StringBuilder sb = new StringBuilder();
- try{
- in = new BufferedReader(new FileReader("izvor.txt"));
- out = new BufferedWriter(new FileWriter("destinacija"));
- String line;
- while((line = in.readLine()) != null){
- sb.append(line);
- }
- out.write(sb.reverse().toString());
- } catch (Exception e) {
- System.out.println(e.getMessage());
- }finally{
- if(in != null) in.close();
- if(out != null) out.close();
- }
- System.out.println(sb);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment