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. static int size;
  11. static int matrixA [][] = new int [size][size];
  12. static Random randomNumber = new Random();
  13.  
  14. public static void main (String[] args) throws java.lang.Exception
  15. {
  16. Ideone.setSize() ;
  17. Ideone.fillMatrixA() ;
  18. }
  19.  
  20. static void setSize()
  21. {
  22. Scanner input = new Scanner( System.in );
  23. System.out.println( "Enter size" );
  24. size = input.nextInt();
  25. }
  26.  
  27. static void fillMatrixA()
  28. {
  29. System.out.println( "length " + new String[7].length ) ;
  30. System.out.println( "matrixA.length " + matrixA.length ) ;
  31. for (int i = 0; i < matrixA.length; i++)
  32. {
  33. System.out.println();
  34. for ( int j = 0 ; j < matrixA[i].length ; j++ )
  35. {
  36. matrixA[i][j] = randomNumber.nextInt(10);
  37. System.out.println(matrixA[i][j]);
  38. }
  39. }
  40. }
  41.  
  42. }
Success #stdin #stdout 0.16s 51808KB
stdin
3
stdout
Enter size
length 7
matrixA.length 0