Build and run a Java program that uses two-dimensional array of int

4. (For your own exercise) Create a NetBeans project as following.
Build and run the program.

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

package threedarray;

/**
 *
 * @author wagle
 */
public class ThreeDArray {
    public ThreeDArray (){
    }

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        //Declare and create three dimensional int
       //array whose size is 3 by 6 by 9
       int[][][]nums = new int[3][6][9];

       //Display the number of rows and columns
       System.out.println("nums.length = " + nums.length);
       System.out.println("nums[1].length = " + nums[1].length);
       System.out.println("nums[2].length = " + nums[2].length);


           }
       }
----------------------------------------------------------------------
output:


run:
nums.length = 3
nums[1].length = 6
nums[2].length = 6
BUILD SUCCESSFUL (total time: 0 seconds)


--------------why is this "not" printing the following.
---------------

nums.length = 3
nums.length = 6
nums.length = 9

is there something I am missing?

--~--~---------~--~----~------------~-------~--~----~
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