having trouble with java programming and toString()
<p>Okay, so I am completely new to all this Java programming stuff, and my knowledge of it is very little, but for my work, I am to:</p>

<blockquote>
  <p>Create a class that represents a rectangle. A rectangle is specified
  by the coordinates (x, y) of its top-left corner and its width and
  height. This class will be used to create many rectangle objects, and
  it must feature</p>
  
  <ul>
  <li>dynamic fields (variables) to store x, y, the width and height as fractional numbers;</li>
  <li>a constructor with parameters that provide x, y, the width and height;</li>
  <li>a function that returns the area of the rectangle;</li>
  <li>a function that returns the length of the perimeter of the rectangle; and</li>
  <li>a function that returns the string representation of the rectangle, the four numbers, within a pair of parenthesis, separated by commas
  [this function must be named <code>toString()</code>]</li>
  </ul>
  
  <p>Write, in a separate class, a main method that accepts the four
  numbers as command line arguments, instantiates a rectangle object,
  and prints the string representation of the rectangle, the area, and
  the perimeter.</p>
</blockquote>

<p>so basically if it works, it should look like :</p>

<blockquote>
  <p>java TestRect 1 2 3 4<br>
  rectangle = (1.0, 2.0, 3.0, 4.0)<br>
  area = 12.0<br>
  perimeter = 14.0  </p>
</blockquote>

<p>okay, sorry, for before, but umm, after reading your answers, ive made some changes, im still not entirely sure if this is what you guys mean, but:</p>

<p>i added </p>

<pre><code>TestRect1 r = new TestRect1();
</code></pre>

<p>to TestRect (the main class)<br> made the changes :</p>

<pre><code>  System.out.println("rectangle = " + r.toString());
  System.out.println("area      = " + r.area(w, h));
  System.out.println("perimeter = " + r.perimeter(w, h));
</code></pre>

<p>to TestRect1 (the other class with all the formulas), and i got rid of the "static" stuff
and added :</p>

<pre><code>   public double x;
   public double y;
   public double w;
   public double h;
</code></pre>

<p>so when i compile them, they both compile, no errors, but when it comes to actually running the program, where i type in</p>

<pre><code>java TestRect 1 2 3 4
</code></pre>

<p>the error pops up saying:</p>

<pre><code>javac: invalid flag: 1
usage: javac &lt;options&gt; &lt;source files&gt;
use -help for a list of possible options
</code></pre>
