try to compare with this code
------------------------------------

package testfor;
public class Main {

public static void main(String[] args) {
 int ii=1000;
 int [][][]ages = new int [10][5][2];
        for (int i=0; i<10;i++){
            for (int j=0; j<5; j++){
                for (int k=0; k<2; k++){
                    ages[i][j][k]=ii++;
                }
            }
        }

         for (int i=0; i<10;i++){
            for (int j=0; j<5; j++){
                for (int k=0; k<2; k++){
                    System.out.println(ages[i][j][k]);
                }
            }
        }
    }
}





--- Mer 23/9/09, Charles Polidano <[email protected]> ha scritto:

Da: Charles Polidano <[email protected]>
Oggetto: [java programming] Three Dimensional Array -  LAB 1036 Exercise 1.24
A: [email protected], [email protected]
Data: Mercoledì 23 settembre 2009, 14:35





Hi All, 

 

i am having problems accessing and initialising a three dimensional 
array. Exercise is asking me to do the following:  

 

 Declare and initialize 3-dimensional array of int 
 Initialize each cell with increasing integer number starting from 1000, 1001, 
1002, and so on 
 

This is what i have done so far :

 

 public static void main(String[] args) {
       

 int [][][]ages = new int [10][5][2];

     
       
    
      

        for (int i=0; i<10;i++){
            for (int j=0; j<5; j++){
                for (int k=0; k<2; k++){
                    System.out.println(ages);
                }
            }
        }

 

Though the output is wrong as you can see below : 

 

 

[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
[...@3e25a5
BUILD SUCCESSFUL (total time: 0 seconds)

 

Can someone please help me out ? 

 

Many Thanks 

 





                                          
What can you do with the new Windows Live? Find out


 





      
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to