title: How do I get this value passed into main properly?
body: <p>i am having trouble passing the value of "guess" into my main method. The 
    method that is trying to return guess just shows up as zero in the main.I have tried various things such as void methods and different returns but the guess value does not get updated in the while loop of the main even though, from what i am seeing, it should be getting updated from the method and passing it down to the guesses right below it.</p>
  
  <pre><code>import java.util.*;
  public class assignment052 {
    public static void main(String[] args) {
      Scanner console = new Scanner(System.in);
      int userGuess = 0;
      int compNum = 0;
      int guess = 0;
      int totalGuesses = 0; //
      int best = 9999; //
      introduction();
  
      int games = 0;
  
      String playAgain = "y";
      while(playAgain.equalsIgnoreCase("y")) {
       System.out.println();
          System.out.println("I'm thinking of a number between 1 and 100...");
          games++;
          guessNumber(console, userGuess, compNum, guess);
       System.out.println(guess);
       totalGuesses += guess;
          System.out.println("Do you want to play again?");
          Scanner newGame = new Scanner(System.in);
          playAgain = newGame.next();
  
       if (best &gt; guess) { // 
          best = guess; // 
          }
  
      }
      result(games, totalGuesses, best);
  
  }
  // Method that introduces the game
  public static void introduction() {
      System.out.println("This program allows you to play a guessing game.");
      System.out.println("I will think of a number between 1 and");
      System.out.println("100 and will allow you to guess until");
      System.out.println("you get it.  For each guess, I will tell you");
      System.out.println("whether the right answer is higher or lower");
      System.out.println("than your guess.");
  }
  
  // method to play 1 game
  public static double guessNumber(Scanner console, int userGuess, int compNum, int guess) {
      Random rand = new Random();
      userGuess = console.nextInt();
      guess = 1;
      compNum = rand.nextInt(100)+1;
      while(compNum != userGuess) {
       if(compNum &gt; userGuess) {
              System.out.println("It's higher.");
          } else {
              System.out.println("It's lower.");
          }
          guess++;
          userGuess = console.nextInt();
      }
      System.out.println("you got it right in " + guess + " guesses");
    return guess;
  }
  // method for overall result
  
  public static void result(int games, int totalGuesses, int best) {
    System.out.println("Overall results:");
    System.out.println();
    System.out.println("Total games played : " + games);
    System.out.println("Total guesses : " + totalGuesses);
    System.out.println("Guesses per game : " + totalGuesses / games);
  }
  </code></pre>
  
  <p>}</p>