Gentlemen, good time of day. Such a question: why with the help of Random when outputting to the console the matrix consists of some obscure values (and they are all the same), and when using the same Random for the usual number, the actual number is displayed, not the "hashcode"
package ru.itpark; import java.util.Random; import java.util.Scanner; public class Main { static int array_NxM[][]; public static void main(String[] args) { Scanner in= new Scanner(System.in); System.out.println("Введите размер матрицы"); System.out.print("Количество строк: "); int n=in.nextInt(); System.out.print("Количество столбцов: "); int m=in.nextInt(); array_NxM= new int [n][m]; Random random =new Random(); for (int i=0; i<n; i++){ for( int j=0; j<m; j++){ array_NxM[i][j]= random.nextInt(); } } for (int i=0; i<n; i++) { for (int j = 0; j < m; j++) { System.out.print(array_NxM+" "); } System.out.println(); } int b=random.nextInt(); System.out.println(); System.out.println(b); } } Here is the conclusion:
Введите размер матрицы Количество строк: 5 Количество столбцов: 5 [[I@6e0be858 [[I@6e0be858 [[I@6e0be858 [[I@6e0be858 [[I@6e0be858 [[I@6e0be858 [[I@6e0be858 [[I@6e0be858 [[I@6e0be858 [[I@6e0be858 [[I@6e0be858 [[I@6e0be858 [[I@6e0be858 [[I@6e0be858 [[I@6e0be858 [[I@6e0be858 [[I@6e0be858 [[I@6e0be858 [[I@6e0be858 [[I@6e0be858 [[I@6e0be858 [[I@6e0be858 [[I@6e0be858 [[I@6e0be858 [[I@6e0be858 1155286982
System.out.print(array_NxM[i][j]);- Igor