Greetings! I am trying to complete the last part of an assignment, though the 2d Arrays are stumping me. The comments are what is supposed to be done, and the rest of the code is stuff I've tried but has not worked. Any assistance would be greatly appreciated. Thanks!

// Menu option 18. Create a 2-D array.
    public static int [] [] multTable(int dimension)
    {
    	String output = "";
    	 int[][] A = new int[dimension][dimension];
    	 for (int i=0; i<dimension; i++){
    		 for (int j=0; j<dimension; j++){
    			 output += "" + A[i][j];
    		 }
    	 }
        // precondition:  dimension >= 1
        // postcondition:  A 2-d dimension x dimension array has been
        //   allocated.  For each row i from 0 through dimension-1,
    	//, column j from 0 through dimension-1, the element in row i,
        //   column j has been filled in with the product i*j
        //   A reference to this array has been returned
        return A;
    }

    // Menu option 18.  Print the 2-D array.
    public static void print2dArr(int [] [] A, int rows, int columns)
    {

        // preconditions:  0 < rows <= A.length.  For each row i from
        //   0 through rows-1, 0 < columns <= A[i].length
        // postcondition: print A for the number of rows and columns
        //   specified.  Put each row on a seperate line.  In each row,
        //   put a space between each element.
    }

Do you have any specific problems or questions?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.