Advertisement
Guest User

Untitled

a guest
Jul 24th, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. import java.io.File;
  2. import java.io.FileInputStream;
  3. import java.io.FileNotFoundException;
  4. import java.io.FileOutputStream;
  5.  
  6. public class FileIO {
  7.  
  8. public static void main(String[] args) {
  9. {
  10. try {
  11. File file=new File("input.txt");
  12. FileInputStream fileInputStream;
  13. fileInputStream = new FileInputStream(file);
  14. FileOutputStream fileOutputStream=new FileOutputStream("output.txt");
  15.  
  16. while (true)
  17. {
  18. int a=fileInputStream.read();
  19. if ((a==-1))
  20. break;
  21. fileOutputStream.write(a);
  22. }
  23. fileInputStream.close();
  24. fileOutputStream.close();
  25.  
  26. } catch (Exception e) {
  27. e.printStackTrace();
  28. }
  29. }
  30.  
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement