title: Multi-Dimesional Array with User Input
body: <p>Trying to change this code so I can get user input instead of a predefined array.  Can anyone help?  This code needs to have the method sum with the double[][] parameter. The method should return the sum of the elements of the array passed to it and should be rectangular.</p>
  <pre><code>import java.util.Scanner;
  
  class Array2_1
  {
      public static double sum (double[][] array)
      {
          double sum = 0;
          for (int i = 0; i &lt; array.length; i++)
          {
              for (int j = 0; j &lt; array[0].length; j++)
              {
                  sum += array[i][j];
              }
          }
          return sum;
      }
  
      public static void main(String[] args)
      {
          System.out.println(&quot;&quot;)
          double a [][] = {
                  {1.2, 2},
                  {6, 7.2},
                  {11, 12}
          };
          System.out.println(sum(a));
      }
  }
  </code></pre>