title: If my game has three lives, how do I subtract one life if the player gets an answer incorrect?
body: <p>My game code is linked below. I have a <em><code>static int</code></em> at the top (above the main), called lives, it has a total of three. Later in my game, I want to make it so when the player gets a question wrong, it subtracts a life from the <em><code>int variable</code>.</em> Is it possible that I can do such a thing? I am later going to have a <em><code>while loop</code></em> that will recognize when they run out of lives, and end the code. Thanks for the help in advance.</p>
  
  <pre><code>package simon_4_randomgame;
  
  import static java.lang.Thread.sleep;
  import java.util.Scanner;
  
  public class Simon_4_RandomGame {
  
      static String username;
      static int lives = 3;
  
      public static void main(String[] args) throws InterruptedException {
  
          Scanner name = new Scanner(System.in);
          System.out.println("Please enter a username.");
          username = name.nextLine();
          System.out.println("");
          System.out.println("Hello, " + username + ". Welcome to Fault.");
          System.out.println("As you make your way through this game you will be");
          System.out.println("encountered with a list of faults. In order to win the");
          System.out.println("game, you must fix these problems. Good Luck!");
          System.out.println("");
          sleep(6000);
          System.out.println("This game gives you three lives. Answer something incorrect...");
          System.out.println("Well. There goes a life. Have fun!");
      }
  
  }
  </code></pre>