fork(2) download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main(String[] args) {
  11.  
  12. int[] array = new int[3];
  13. int[] array2 = new int[3];
  14. Scanner scan = new Scanner(System.in);
  15.  
  16. int i = 0;
  17. while(scan.hasNextInt()){
  18. array[i] = scan.nextInt();
  19. i++;
  20. if(i == 3){
  21. break;
  22. }
  23. }
  24.  
  25. i = 0;
  26. while(scan.hasNextInt()){
  27. array2[i] = scan.nextInt();
  28. i++;
  29. if(i == 3){
  30. break;
  31. }
  32. }
  33.  
  34. for(int j = 0; j < array.length; j++){
  35. System.out.print(array[j] + " ");
  36. }
  37. System.out.println();
  38. for(int j = 0; j < array2.length; j++){
  39. System.out.print(array2[j] + " ");
  40. }
  41. }
  42. }
Success #stdin #stdout 0.1s 380736KB
stdin
4 5 6
8 9 0
stdout
4 5 6 
8 9 0