import java.util.*;
import java.lang.*;
import java.io.*;
//import java.util.Random;
// The main method must be in a class named "Main".
class Main {
public static void main(String[] args) {
Scanner tecl = new Scanner(System.in);
// en la si
String [] vector = new String[5];
//
int [] otroArreglo = {125,150,175,200,225,250,275,300,325};
int tama = otroArreglo.length;
//
System.out.println("El tamaño de arreglo de una dimención (Vector) es: " + tama);
//
for(int v=0; v < otroArreglo.length; v++){
//
System.out.println("\nEn la posición : " + v + " se encuentra el valor de: " + otroArreglo[v]);
//
if(v<vector.length){
vector[v] = tecl.nextLine();
}
}
int [][] arreglo2D;
int f=0;
int c=0;
System.out.println("Cuantas filas desea agregarle a su matriz: ");
f = tecl.nextInt();
System.out.println("Cuantas columnas desea agregarle a su matriz: ");
c = tecl.nextInt();
//
arreglo2D = new int[f][c];
//
Random rock = new Random();
System.out.println("Valores f y c : " + f + " - " + c);
for(int i=0; i<f; i++){
for (int j=0; j<c; j++){
//
int x = rock.nextInt(99);
//System.out.println("Valor a guardar en la matriz: " + x);
arreglo2D[i][j] = x;
}
}
//
System.out.println("\n Valor en la fil 3 columna 2: " + arreglo2D[2][1] );
System.out.println("\n\n" );
//
for(int i=0;i<f;i++){
for (int j=0; j<c;j++){
//
System.out.print(arreglo2D[i][j] + " - ");
}
//
System.out.println("\n");
}
}
}
To embed this project on your website, copy the following code and paste it into your website's HTML: