Guest User

Untitled

a guest
Jul 21st, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. import java.io.*;
  2. import java.util.*;
  3.  
  4. class FileJoin {
  5.  
  6. public static void main(String [] args) {
  7. try {
  8. PrintWriter p = new PrintWriter(args[2]);
  9. Scanner one = new Scanner(new File(args[0]));
  10. Scanner two = new Scanner(new File(args[1]));
  11.  
  12.  
  13. while(one.hasNext()) {
  14. String input = one.next();
  15. p.print(input + " ");
  16. }
  17. one.close();
  18. while(two.hasNext()) {
  19. String input = two.next();
  20. p.print(input + " ");
  21. }
  22. two.close();
  23. p.close();
  24. }
  25. catch(Exception e) {
  26. e.printStackTrace();
  27. }
  28.  
  29. }
  30.  
  31. }
Add Comment
Please, Sign In to add comment