title: getting random int from function to new function
body: <p>I'm trying to do a simple guessing game in java. I've got functions for creating a random number and guessing the number. However, in guessing the number there is no variable declared as a random to guess. I'm wondering how to get my random number from one function to be available in the guessing function. Here is my code:</p>
  
  <pre><code>public static void Final(){
      Random rand = new Random();
      int number = rand.nextInt(10) + 1;
  }
  
  public static void Guess(){
  
      Scanner scan = new Scanner(System.in);
      int pick = scan.nextInt();
  
      if(pick &gt; number){
          System.out.println("Your number is too high.");
          Guess();            
      }else if(pick &lt; number){
          System.out.println("Your number is too low.");
          Guess();
      }else if(pick == number){
          System.out.println("Correct!");
      }
  </code></pre>