title: Calling a constructor from method within the same class
body: <p>I'm new to java and I'm learning about creating object classes. One of my homework assignment requires that I call the constructor at least once within a method of the same object class. I'm getting an error that says <code>The method DoubleMatrix(double[][]) is undefined for the type DoubleMatrix</code></p>
  
  <p>Here's my constructor:</p>
  
  <pre><code>public DoubleMatrix(double[][] tempArray)
  {
      // Declaration
      int flag = 0;
      int cnt;
  
      // Statement
  
      // check to see if doubArray isn't null and has more than 0 rows
      if(tempArray == null || tempArray.length &lt; 0)
      {
          flag++;
      }
  
      // check to see if each row has the same length
      if(flag == 0)
      {
          for(cnt = 0; cnt &lt;= tempArray.length - 1 || flag != 1; cnt++)
          {
              if(tempArray[cnt + 1].length != tempArray[0].length)
              {
                  flag++;
              }
          }
      }
      else if(flag == 1)
      {
          makeDoubMatrix(1, 1);// call makeDoubMatrix method
      }
  
  }// end constructor 2
  </code></pre>
  
  <p>Here's the method where I try and call the constructor:</p>
  
  <pre><code>public double[][] addMatrix(double[][] tempDoub)
  {
      // Declaration
      double[][] newMatrix;
      int rCnt, cCnt;
  
      //Statement
  
      // checking to see if both are of same dimension
      if(doubMatrix.length == tempDoub.length &amp;&amp;
              doubMatrix[0].length == tempDoub[0].length)
      {
          newMatrix = new double[doubMatrix.length][doubMatrix[0].length];
  
          // for loop to add matrix to a new one
          for(rCnt = 0; rCnt &lt;= doubMatrix.length; rCnt++)
          {
              for(cCnt = 0; cCnt &lt;= doubMatrix.length; cCnt++)
              {
                  newMatrix[rCnt][cCnt] = doubMatrix[rCnt][cCnt] + tempDoub[rCnt][cCnt];
              }
          }
      }
      else
      {
          newMatrix = new double[0][0];
          DoubleMatrix(newMatrix)
      }
  
      return newMatrix;
  }// end addMatrix method
  </code></pre>
  
  <p>Can someone point me to the right direction and explain why I'm getting an error?</p>