MHSS

Java File Operations

Jul 18th, 2016
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.92 KB | None | 0 0
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6.  
  7. /**
  8.  *
  9.  * @author install
  10.  */
  11. import java.util.Scanner;
  12. import java.io.File;
  13. import java.io.FileNotFoundException;
  14. import java.io.IOException;
  15. import java.io.FileOutputStream;
  16. import java.io.PrintStream;
  17.  
  18. public class Main {
  19.  
  20.     /**
  21.      * @param args the command line arguments
  22.      */
  23.     public static void main(String[] args) throws Exception{
  24.         // TODO code application logic
  25.                
  26.         File file = new File("ciphertext.txt");
  27.         FileOutputStream fis = new FileOutputStream(file);
  28.         Scanner in = new Scanner(new File("planetext.txt"));
  29.         PrintStream out = new PrintStream(fis);
  30.         System.setOut(out);
  31.         System.out.println(in.next());
  32.            
  33.        
  34.     }
  35.    
  36. }
Add Comment
Please, Sign In to add comment