title: Changing boolean value in another method?
body: <p>When I use the following code in Java 8 within NetBeans it doesn't seem to work well. For example, in one method I create the following:</p>
  
  <pre><code>boolean isGuessCorrect = true;
  </code></pre>
  
  <p>It is then passed to another method where it can be used. However, if I then have some conditional statement that changes the value it doesn't work. NetBeans actually tells me that it can't be changed. Instead I am forced to use something like this:</p>
  
  <pre><code>int isGuessCorrect = 1;
  </code></pre>
  
  <p>When I use that approach, treating 1 as true and 0 as false, I have no problems changing the values of the variables and passing them around as needed. </p>
  
  <p>The problem is that, for readability, I would prefer using true/false rather than using digits to store the true/false conditions. Is there something special about them that keeps it from working the way I want?</p>
  
  <p><strong>EDIT:</strong> This is a very simple text based game that uses logical control of methods and passing variables to handle events in the game.</p>
  
  <pre><code>public static void main(String[] args)
  {
          //Sets the game status and difficulty.
          //Using as a separate method so I don't have these variables overwritten on subsequent runs.
          int newGame = 1;
          int difficulty = 6;
          game_menu1(newGame, difficulty);        
  }
  </code></pre>
  
  <p>The above is what I currently have to use, however, what I initially attempted was:</p>
  
  <pre><code>        boolean newGame = true;
  </code></pre>
  
  <p>The idea is that, depending on if the game is new or not, different things would occur.</p>
  
  <p>In a later part of the program:</p>
  
  <pre><code>        public static void game_menu2(int newGame, int difficulty, int digit1, int digit2, int choice, int counter)
  {
      newGame = 0;
  </code></pre>
  
  <p>The above is what I am currently using. I change the 1 to 0 to indicate that the game is no longer new. However, if I used </p>
  
  <pre><code>        public static void game_menu2(boolean newGame, int difficulty, int digit1, int digit2, int choice, int counter)
  {
      newGame = false;
  </code></pre>
  
  <p>It doesn't work. I'm sorry, but I would have to change a great deal more since I reference this in several places before I can get the exact error message.</p>
  
  <p><strong>EDIT 2</strong>: hmm. Even though I had the problem a few hours ago and last night, after changing the code to use boolean variables where needed I am not seeing the same error code. It's likely that the problem I had was something unrelated, a bug that just looked like it was an issue with boolean itself. It's also possible that I had a final operator in place previously where I am not currently using it. Even though I am very familiar with other languages, I am still learning Java in a classroom setting.</p>
  
  <p>I would accept as a correct answer anyone that can show me the situations where this type of problem would normally be expected to occur.</p>