title: Find the sum of array using multiple threads
body: <p>This is my first time trying to work with multithreading so help would be appreciated!</p>
  <p>Following problem:</p>
  <p>The user enters values for the array, as well as desired quantity of threads to the console. The array should be summed using those threads and each thread finds the sum of its own chunk in array. The summed result should be printed for each thread and also overrall sum.</p>
  <pre><code>public class Thread1  extends Thread{
  
      @Override
      public void run() {
          System.out.println(&quot;Enter the required size of the array :: &quot;);
          Scanner s = new Scanner(System.in);
          int size = s.nextInt();
          int[] myArray = new int [size];
          System.out.println(&quot;Enter the required quantity of the threads :: &quot;);
          int k = s.nextInt();
          int sum = 0;
          System.out.println(&quot;Enter the elements of the array one by one &quot;);
          
          for(int i=0; i&lt;size; i++) {
              myArray[i] = s.nextInt();
  
              for(int j = 0; j&lt; k; j++){
                  sum = sum + myArray[i];
  
              }
              System.out.println(&quot;Sum for thread: &quot; + this.getName() + &quot; = &quot; + sum);
          }
          System.out.println(&quot;Elements of the array are: &quot;+ Arrays.toString(myArray));
          System.out.println(&quot;Sum of the elements of the array ::&quot;+sum);
      }
  
      public static void main(String[] args) {
          Thread1 t = new Thread1();
          t.start();
  
  
  
      }
  }
  
  </code></pre>