title: Why I can't return nothing in a static method this way
body: <p>I wrote a piece of code just to train a litte bit and I wanted to understand why I cannot use this notation.</p>
  
  <pre><code>public static double retangleArea (double c, double d) {
    double area = c * d;
    if ( c &lt; 0 || d &lt; 0) {
      System.out.println("Error.");
      return;
    }
    return area;
  }
  </code></pre>
  
  <p>If I call this method in my main() it will shout "Error." and still calculate (c * d) with a negative number but I wanted just the print to show in. Well, I know how to get rid of this problem I just want to understand why I can't do this way and what's the problem with that. </p>