title: How to return specific int values from an array; How to make a testclass?
body: <p>I started to code an assignment for uni, but after a short while, i got stuck.</p>
  
  <pre><code>public class MostCommonElemnt
  {
      //private int[] liste;
      public MostCommonElemnt()
      {
          //int[] liste = {1,2,3,4,5,6,7,8,9};
      }
  </code></pre>
  
  <p>Is it bad to initialize an array in the constructor, or is it just not necassary? </p>
  
  <pre><code>    public int findMostCommonElemnt(int[] list)
      {
          int help = 0; 
          for(int i = 0; i &lt; liste.length; i++)
          {
              help = list[i];
  
          }
          return help; 
      }
  </code></pre>
  
  <p>Here i tried to get a specific int value (or number) returned from my int array, but "help" only returns the last number from the int array. How do i get the 2nd or 4th? To see all of them i can use System.out.println();</p>
  
  <pre><code>    public static void main (int[] args)
      {
          //int[] liste = {1,2,3,4,5,6,7,8,9};
          System.out.println(new MostCommonElemnt().findMostCommonElemnt(int[] list));
      }
  }
  </code></pre>
  
  <p>In this section i tried to make a testMethod but, i can not get it to work,
  BlueJ (we have to use it for uni) always complaints about something. 
  I especially to not know, what to do after the </p>
  
  <pre><code>    new MostCommonElemnt().
  </code></pre>
  
  <p>I just want, the programm to take specific numbers, with which i want to test. e.g: {1,2,3,4,5,6,7...}
  otherwise i always have to type them in, which gets boring fast.</p>