title: Static reference to non-static method
body: <p>We were given this specification for the PercolationStats class:</p>
  
  <pre><code>public class PercolationStats {
     public PercolationStats(int N, int T)    // perform T independent computational experiments on an N-by-N grid
     public double mean()                     // sample mean of percolation threshold
     public double stddev()                   // sample standard deviation of percolation threshold
     public double confidenceLo()             // returns lower bound of the 95% confidence interval
     public double confidenceHi()             // returns upper bound of the 95% confidence interval
     public static void main(String[] args)   // test client, described below
  }
  </code></pre>
  
  <p>and to implement mean() and stddev(), we had to use a special library that has a class called StdStats:</p>
  
  <pre><code>public final class StdStats {
  
  private StdStats() { }
  
  /* All methods declared static. */
  
  }
  </code></pre>
  
  <p>I tried to write something like </p>
  
  <pre><code>public mean() {
  
  return StdStats.mean();
  
  }
  </code></pre>
  
  <p>but I get the following error:</p>
  
  <pre><code>Cannot make a static reference to the non-static method mean() from the type PercolationStats
  </code></pre>
  
  <p>Here is what's presumably generating it:</p>
  
  <pre><code>main() {
  
  /* ... */
  
          System.out.println("-- Summary --\n");
          System.out.printf("mean\tstdev\t[lo\thi]\n\n");
          System.out.printf("%1.3f\t%.3f\t%.3f\t%.3f", PercolationStats.mean(), 
                            PercolationStats.stddev(), PercolationStats.confidenceLo(), PercolationStats.confidenceHi());
  
          System.out.println("-- End --");
  }
  </code></pre>
  
  <p>Is there a way to get rid of this error without changing the specification? I believe we're supposed to be able to make PercolationStats objects. Thanks for any help!</p>