java - Trouble printing my list -


if see i'm keeping numbers in matrix below list according me there are keeping these numbers , when try print list send me lot of these: i@7852e922 memory address? , if objects print. thank attention.

package estructurasdedatos;  import java.util.list;  import java.util.linkedlist;  public class matriz {      private static scanner read;      public static void main(string[] args){         /*read = new scanner(system.in);          system.out.println("ingrese el numero de filas y columnas: ");          int f = read.nextint();          int c = read.nextint();*/          linkedlist ll = new linkedlist();          system.out.println("     **   **      ***   ******* ****     *****    ***  *****   *****  ");         system.out.println("    *   **   *   *   *     *    *   *      *     *     *      *       ");         system.out.println("    *   **   *  *     *    *    *   *      *    *      *      *       ");         system.out.println("    *        *  *******    *    ****       *    *      ***     ****   ");         system.out.println("    *        *  *     *    *    *   *      *    *      *           *  ");         system.out.println("    *        *  *     *    *    *    *     *     *     *           *  ");         system.out.println("    *        *  *     *    *    *     *  *****    ***  *****  *****   ");         system.out.println("###########################################################################");         int mt [][] = new int[10][10];//genero la matriz con dos arreglos con una cantidad que yo quiera de         //filas y columnas.          int num;         (int = 0; < 10; i++)         {             (int j = 0; j < 10; j++)             {//genero un numero aleatorio entre 0 y 100                 num=(int)(math.random()*100);                  //asigno el numero generado la matriz                 mt[i][j]=num;                 ll.push(mt);             }         }          (int = 0; < 10; i++)         {             (int j = 0; j < 10; j++)             {//imprimo la celdad de la matriz                  system.out.print(mt[i][j]+"\t");             }              system.out.println();         }         system.out.println("###########################################################################");         system.out.println("\n\n");         system.out.println("los numeros de la diagonal principal:");         system.out.print(mt[0][0]+" "+mt[1][1]+" "+mt[2][2]+" "+mt[3][3]+" "+mt[4][4]+" "+mt[5][5]+" "+mt[6][6]+" "+mt[7][7]+" "+mt[8][8]+" "+mt[9][9]+"\n\n");          int sumatoriadiap=mt[0][0]+mt[1][1]+mt[2][2]+mt[3][3]+mt[4][4]+mt[5][5]+mt[6][6]+mt[7][7]+mt[8][8]+mt[9][9];          system.out.println("la sumatoria de la diagonal principal es: \n"+sumatoriadiap);          system.out.println("el promedio de la diagonal principal es : \n"+sumatoriadiap/10);         ////////////////////////////////////////////////////////////////////////////////////////////////////////         system.out.println("los numeros de la diagonal secundaria:");         system.out.print(mt[0][9]+" "+mt[1][8]+" "+mt[2][7]+" "+mt[3][6]+" "+mt[4][5]+" "+mt[5][4]+" "+mt[6][3]+" "+mt[7][2]+" "+mt[8][1]+" "+mt[9][0]+"\n\n");          int sumatoriadias=mt[0][9]+mt[1][8]+mt[2][7]+mt[3][6]+mt[4][5]+mt[5][4]+mt[6][3]+mt[7][2]+mt[8][1]+mt[9][0];          system.out.println("la sumatoria de la diagonal principal es: \n"+sumatoriadias);          system.out.println("el promedio de la diagonal principal es : \n"+sumatoriadias/10);     } } 

i believe you're adding wrong element linkedlist

for (int j = 0; j < 10; j++) {     num = (int) (math.random() * 100);     mt[i][j] = num;     ll.push(num); //add random number linkedlist instead of whole 2 dime array } 

then printing add like:

system.out.println(ll); 

Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -

php - $params->set Array between square bracket -