fork(1) 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. Matrix m1 = new Matrix(3,2);
  13. //System.out.println(m1.m +" "+ m1.n); -> Mostra corretamente os valores "3" e "2"
  14. m1.arr[0][0] = 1;
  15. m1.arr[1][1] = 1;
  16. m1.arr[2][0] = 1;
  17. m1.arr[0][1] = 1;
  18. m1.arr[1][0] = 1;
  19. m1.arr[2][1] = 1;
  20.  
  21. for(int[] i : m1.arr){
  22. for(int n : i){
  23. System.out.println(n);
  24. }
  25. }
  26.  
  27. //Matrix m2 = new Matrix(3,2); // your code goes here
  28. }
  29. }
  30.  
  31. class Matrix {
  32.  
  33. Scanner ler = new Scanner (System.in);
  34. int m;
  35. int n;
  36. int [][] arr;
  37.  
  38. Matrix(int a, int b){
  39. m = a;
  40. n = b;
  41. arr = new int[m][n];
  42. }
  43.  
  44. }
Success #stdin #stdout 0.06s 711680KB
stdin
Standard input is empty
stdout
1
1
1
1
1
1