title: non-Static method toString cannot be referenced from a static context
body: <p>I'm trying to create a program that reads user input and stores it and then calculates the area of a polygon. When I try and compile it it gives me one error which is the one about <code>.toString</code> being non static.</p>
  <pre><code>import java.util.Scanner;
  
  class regularpoTest {
      public static void main(String[] args) {
      
          Scanner in = new Scanner(System.in);
          boolean finished = false;
          double s;
          double n;
          double area;
          //starts loop to record data
          do {
              s =0;
              n =0;
          
          
              System.out.println(&quot;Enter the side length, or anything else to quit: &quot;);
              s = in.nextDouble();
              in.nextLine();
              if (in.hasNextDouble()) {
                  System.out.println(&quot;Enter number of sides&quot;);
                  n = in.nextDouble();
                  area = (s*s*n)/(4*Math.tan(Math.PI/n));
              } else {
                  finished = true;
              
              }
          } while(!finished);
      
          //This prints out the student details 
      
          System.out.println(regularpo.toString());
      
      }
  }  
  </code></pre>
  <hr />
  <pre><code>public class regularpo {
  
      private double side;
      private double numberOf;
      private double area;
      
      public regularpo(double side, double numberOf){
          side = 0;
          numberOf = 0;
          area = 0;
      }
      
      public double getSide(){
          return side;
      }
      public double getNumberOf(){
          return numberOf;
      }
      public String toString(){
          return (&quot;area = &quot; + area+ &quot; side length &quot;+side+ &quot; number of sides &quot;+numberOf);
      }
  }
  </code></pre>