fork 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) throws java.lang.Exception
  11. {
  12. int[][] horz = new int[][] {{1,1}, {1,0}, {1,1} };
  13. int[][] ver = new int[][] { {1,1,1}, {1,1,1} };
  14.  
  15. createMatrices(horz, ver);
  16. }
  17.  
  18. public static void createMatrices(int[][] horz, int[][] ver)
  19. {
  20. for (int i = 0; i < horz.length-1; i++) {
  21. for (int j = 0; j < horz[i].length; j++) {
  22. System.out.print(horz[i][j]==1?" -- ":" ");
  23. }
  24. System.out.println();
  25. for (int k = 0; k < ver[i].length; k++) {
  26. System.out.print(ver[i][k]==1?"| ":" ");
  27. }
  28. System.out.println();
  29. }
  30. int i = horz.length - 1;
  31. for (int j = 0; j < horz[i].length; j++) {
  32. System.out.print(horz[i][j]==1?" -- ":" ");
  33. }
  34. System.out.println();
  35. }
  36. }
Success #stdin #stdout 0.06s 380160KB
stdin
Standard input is empty
stdout
  --   -- 
|    |    |    
  --      
|    |    |    
  --   --