Advertisement
Josif_tepe

Untitled

Mar 23rd, 2021
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.63 KB | None | 0 0
  1. import java.io.*;
  2. public class Main {
  3.  
  4.     public static void main(String[] args) {
  5.         FileOutputStream out = null;
  6.         try {
  7.             out = new FileOutputStream("out.txt");
  8.             for(int x = System.in.read(); x != 88; x = System.in.read()) {
  9.                 out.write(x);
  10.             }
  11.         }
  12.         catch (IOException ex) {
  13.             System.out.println(ex);
  14.         }
  15.         finally {
  16.             try {
  17.                 if(out != null)
  18.                  out.close();
  19.             }
  20.             catch (IOException ex) {
  21.                 System.out.println(ex);
  22.             }
  23.         }
  24.  
  25.     }
  26. }
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement