Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #OS LAB1/2 made by Fensa08
- import java.io.*;
- import java.util.ArrayList;
- import java.util.Collections;
- public class HW01_2 {
- public static void main(String args[]) {
- FileInputStream in = null;
- FileOutputStream out = null;
- try{
- out = new FileOutputStream(new File("destinacija.txt"));
- in = new FileInputStream(new File("izvor.txt"));
- ArrayList<Character> txt = new ArrayList<>();
- Character c;
- while(in.available() > 0){
- c = (char) in.read();
- txt.add(c);
- }
- Collections.reverse(txt);
- for(Character it: txt){
- System.out.println(it);
- out.write((int)it);
- }
- out.close();
- in.close();
- } catch (Exception e) {
- System.out.println(e.getMessage());
- }
- }
- }
- /*
- izvor.txt : Hello World !
- destinacija : ! dlroW olleH
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement