Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package mm;
- import java.util.Random;
- public class Mm {
- public static void main(String[] args) {
- int m[][] = new int[3][3];
- preencher(m);
- exibir(m);
- System.out.println("Primeiro: " + primeiro(m));
- }
- public static void preencher(int x[][]) {
- Random R = new Random();
- for (int l = 0; l < x.length; l++) {
- for (int c = 0; c < x[l].length; c++) {
- x[l][c] = R.nextInt(21);
- }
- }
- }
- public static void exibir(int a[][]) {
- for (int i = 0; i < a.length; i++) {
- for (int j = 0; j < a[i].length; j++) {
- System.out.print(a[i][j] + " ");
- }
- System.out.println(" ");
- }
- }
- public static int primeiro(int m[][]) {
- return m[0][0];
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement