import java.util.Scanner; public class MatrizIrregular1 { private Scanner teclado; private int[][] mat; public void cargar() { teclado=new Scanner(System.in); System.out.print("Cuantas fila tiene la matriz:"); int filas=teclado.nextInt(); mat=new int[filas][]; for(int f=0;f<mat.length;f++) { System.out.print("Cuantas elementos tiene la fila " + f + ":"); int elementos=teclado.nextInt(); mat[f]=new int[elementos]; for(int c=0;c<mat[f].length;c++) { System.out.print("Ingrese componente:"); mat[f][c]=teclado.nextInt(); } }