title: How to make the scanner understand the amount I write?
body: <p>This is just some homework but I cannot find a way to achieve it like I want. Have a look at my code please.
  Once the numbers are typed, I'd just like to play around with them.</p>
  
  <pre><code>public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);
      //user says if he'd like to use 3 numbers for instance (2,4,5)
      System.out.println("How many numbers would you like to use? : ");
      int amountOfNumbers = sc.nextInt();
      System.out.println("Great! Please type in your numbers: ");
      int numbers =sc.nextInt(amountOfNumbers);
      // should let him write the amount of numbers he entered    
  }
  </code></pre>
  
  <p>Once he has typed the amount of numbers he'd like to use, I would like the scanner to give him the possibility to type in all of those numbers.</p>
  
  <p>Let's say he the amount of numbers he'd like to use is three.
  I would like him to be able to type it in the console like this:</p>
  
  <ul>
  <li>First number + enter key</li>
  <li>Second number + enter key</li>
  <li>Third number + enter key</li>
  <li>Not able to write anymore</li>
  </ul>
  
  <p>That is what I meant here by adding "amountOfNumbers" in the scanner itself... (which is not working)</p>
  
  <pre><code>int numbers =sc.nextInt(amountOfNumbers);
  </code></pre>
  
  <p>BR</p>