title: How does the syntax look like to create and test a vector? [level: newbie]
body: <p>I'm studying Java a bit and want to create a vector class to understand exceptions and arrays. In my case I go with double arrays first.</p>
  
  <p>I implemented two constructors for my class. One for the length and one for the array.</p>
  
  <p>The variable length contains the length of the vector.</p>
  
  <p>Get() and set() were implemented to read or change the values.</p>
  
  <p>Minimum(), maximum() and average() were implemented to get the wanted  values of the array.</p>
  
  <p>toString() should print the vector as a string.</p>
  
  <p>My code so far</p>
  
  <pre><code>public class MyVector {
  
      //lenght of the vector
      public final int l;
  
      //array representing the vector
      private double[] arr;
  
  
      // Constructs vector.
      public MyVector(int l) {
          this.l = l;
          arr = new double[l];
      }
  
      // Constructs  vector from  existing array
      public MyVector(double[] array) {
          l = array.length;
  
          // copy]
          arr = new double[l];
          for (int i = 0; i &lt; l; i++)
              arr[i] = array[i];
      }
  
  
      //gets value at the given index.
      public double get(int index) {
          return arr[index];
  
      }
  
      // Sets  value at the given index.
      public double set(int index, double value) {
  
      }
  
  
      // Returns the minimal value in the vector.
      public double minimum() {
          double minimum = get(0);
  
          for (int i=1; i&lt;arr.l; i++)
              if (get(i)&lt;minimum)
                  minimum = get(i);
  
          return minimum;    }
  
      // Returns the maximal value in the vector.
      public double maximum() {
          double maximum = get(0);
  
          for (int i=1; i&lt;arr.l; i++)
              if (get(i)&gt;maximum)
                  maximum = get(i);
  
          return maximum;    }
  
      // the average of all values in the vector
      public double average() {
          double sum = 0;
  
          for (int i=0; i&lt;arr.l; i++)
              sum += get(i);  
          return sum/arr.l;
      }
  
  
      @Override
      public String toString() {
          return "[arr=" + arr.l
                  + " min=" + min()
                  + " max=" + maximum()
                  + " avg=" + average();
      }
  }
  </code></pre>
  
  <p>First of all I want to test some vectors. I guess I need testerclass for my vector with <code>public static void main(String[] args) { }</code> and two testermethods. One to test the class and one to test the methods of the class. How would the syntax look like to create and test a vector?</p>
  
  <p>I appreciate any feedback to my myvector class as well.</p>
  
  <p>Thank you.</p>