title: How to get variables from the command line in Java?
body: <p>I've finished writing a java program about a drinksBot. I just have one issue; I need two variables from the command line to be saved as int variables eg.</p>
  
  <p>The user types in:</p>
  
  <p>java DrinksBot 30 40</p>
  
  <p>and the program begins to run, and saves </p>
  
  <pre><code>int cupStock=  30;
  
  int shotStock = 40;  //or whatever the user typed into the command line.
  </code></pre>
  
  <p>Any help would be greatly appreciated; I'm new to this!</p>
  
  <p>My code begins like this:</p>
  
  <pre><code>  import java.util.Scanner;
    public class DrinksBot {
  
          static Scanner keyboard = new Scanner (System.in);
  
             public static void main(String[] args) {
  
                System.out.print("Hello, what's your name? I have"+cupStock+" cups left, and " + shotStock+" shots left.);
  </code></pre>
  
  <p>... continues to run rest of program etc.</p>