title: // answered thank u // Java reads certain amount of numbers outputs the product
body: <p>Been able to write the code to read 4 numbers in the array and output the product of all numbers greater than / equal to zero. BUT, with the product of numbers less than zero, is different story.</p>
  <pre><code>public class Main {
  public static void main(String[] args) {
      Scanner scan = new Scanner(System.in);
  int product = 1;
  int negProduct = 1;
  
  int[] array = new int[4];
  System.out.println(&quot;Enter 4 integers&quot;);
  for(int i = 0; i &lt; array.length; i++) {
      array[i] = scan.nextInt();
  
     if (array[i] &gt;= 0) {
         product = product * array[i];
      }
  
      else {
          negProduct = negProduct * array[i];
      }
  
      System.out.println(&quot;Product of non-negatives = &quot; + product);
      System.out.println(&quot;Product of negatives = &quot; + negProduct);
  }
  </code></pre>
  <p>This is the test code and how it runs</p>
  <pre><code>Enter 4 integers
  2 6 -4 7
  
  Product of non-negatives = 84
  Product of negatives = -4
  </code></pre>
  <p>I've tried to have an if &amp; else statement to make it run 0 instead of 1 for both negative and positives when there is none but haven't got it to work</p>
  <p>Similarly to the 'else' statement but when I have it uncommented all answers are 0.</p>