Guest User

Untitled

a guest
Dec 10th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. package ESOPAB4;
  2.  
  3. public class AB1 {
  4. public static void main(String[] args) {
  5. int[][] a = {{1,2,3},{4,5,6},{7,8,9}};
  6. boolean[][] b = {{true,false},{false,false},{true,true},{false,true},{false,false},{true,false},{false,true}};
  7. char[][] c = {{'a','a','b','c','d','f','h'},{'s','c','b','c','g','k','z'},{'d','e','t','g','d','x','h'}};
  8. int[][] d = {{1,2,3,4},{5,6,7},{8,9},{1}};
  9. print2DArrayToScreen(a);
  10. System.out.println();
  11. print2DArrayToScreen(b);
  12. System.out.println();
  13. print2DArrayToScreen(c);
  14. System.out.println();
  15. print2DArrayToScreen(d);
  16.  
  17. }
  18.  
  19. static void print2DArrayToScreen(int[][] a){
  20. for (int[] x: a) {
  21. for (int out: x) {
  22. System.out.print(out +",");
  23. }
  24. System.out.println();
  25. }
  26. }
  27. static void print2DArrayToScreen(boolean[][] b) {
  28. for (boolean[] x: b) {
  29. for (boolean out: x) {
  30. System.out.print(out +",");
  31. }
  32. System.out.println();
  33. }
  34. }
  35. static void print2DArrayToScreen(char[][] c) {
  36. for (char[] x: c) {
  37. for (char out: x) {
  38. System.out.print(out +",");
  39. }
  40. System.out.println();
  41. }
  42. }
  43.  
  44.  
  45. }
Add Comment
Please, Sign In to add comment