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) throws java.lang.Exception
  11. {
  12. // your code goes here
  13. MyDesk barco = new MyDesk();
  14. //EnemyDesk enemigo = new EnemyDesk();//
  15. int [][] EnemyDesk = null;
  16. MyDesk barco1 = new MyDesk(EnemyDesk);
  17. }
  18. }
  19.  
  20. class MyDesk {
  21. int [][] barcosvivos;
  22. public MyDesk(){
  23. this.barcosvivos = new int[5][5];
  24. barcosvivos [1][0] = 1; barcosvivos [2][0] = 1; barcosvivos[3][0]=1;
  25. barcosvivos [1][2]= 1; barcosvivos [1][3]= 1; barcosvivos [1][4]= 1;
  26. for (int []interno: this.barcosvivos){System.out.println(Arrays.toString(interno));}
  27. }
  28. public MyDesk (int [][] EnemyDesk){
  29. EnemyDesk = new int [5][5];
  30. EnemyDesk [0][2] = 3; EnemyDesk [0][3] = 3; EnemyDesk [0][4] = 3;
  31. EnemyDesk [2][0] = 3; EnemyDesk [2][1] = 3; EnemyDesk [2][2] = 3;
  32. for (int []interno2: EnemyDesk){System.out.println(Arrays.toString(interno2));}
  33. }
  34. }
  35.  
Success #stdin #stdout 0.12s 320576KB
stdin
Standard input is empty
stdout
[0, 0, 0, 0, 0]
[1, 0, 1, 1, 1]
[1, 0, 0, 0, 0]
[1, 0, 0, 0, 0]
[0, 0, 0, 0, 0]
[0, 0, 3, 3, 3]
[0, 0, 0, 0, 0]
[3, 3, 3, 0, 0]
[0, 0, 0, 0, 0]
[0, 0, 0, 0, 0]