title: Keep getting this error message for my RockPaperScissor Program. How do I fix this error?
body: <p>this is the error message</p>
  
  <pre><code> ----jGRASP exec: javac -g RockPaperScissorRandom.java
  
  RockPaperScissorRandom.java:40: error: variable computerPlay might not have been initialized
        **System.out.println("Computer play is: " + computerPlay);**
                                                  ^
  1 error
  
   ----jGRASP wedge2: exit code for process is 1.
   ----jGRASP: operation complete.
  </code></pre>
  
  <p>this is the program</p>
  
  <pre>
  import java.util.Scanner;
  import java.util.Random;
  
  public class RockPaperScissorRandom{
     public static void main(String[]args){
  
        String personPlay; //User's play -- "0", "1", or "2"
        String computerPlay; //Computer's play -- "0", "1", or "2"
        int computerInt; //Randomly generated number used to determine computer's  play
  
        String response;
  
        Scanner scan= new Scanner(System.in);
        Random generator  = new Random();
  
        System.out.println("Hey, let's play Rock, Paper, Scissors!\n" + "Please enter a move.\n" + "Rock = 0, Paper = 1, and Scissors = 2.");
  
        System.out.println();
  
        //Generate computer's play (0,1,2)
        computerInt = generator.nextInt(3)+1;
  
        //Translate computer's randomly generated play to //string using if //statements
  
        if (computerInt == 1)
           computerPlay = "0";
        else if (computerInt == 2)
           computerPlay = "1";
        else if (computerInt == 3)
           computerPlay = "2";
  
        //Get player's play from input-- not that this is stored as a string
        System.out.println ("Enter your play: ");
        personPlay = scan.next();
  
        //Make player's play uppercase ofr ease of comparison
        personPlay = personPlay.toUpperCase();
  
        //Print computer's play
        <strong>System.out.println("Computer play is: " + computerPlay);</strong>
  
        //See who won. use nested ifs
  
        if (personPlay.equals(computerPlay))
           System.out.println("It's a tie!");
        else if (personPlay.equals("0"))
           if (computerPlay.equals("2"))
           System.out.println("Rock crushes scissors. You WIN!!");
        else if (computerPlay.equals("1"))
           System.out.println("Paper eats rock. You LOSE!!");
        else if (personPlay.equals("1"))
           if (computerPlay.equals("2"))
           System.out.println("Scissors cuts paper. You LOSE!!");
        else if (computerPlay.equals("0"))
           System.out.println("Paper eats rock. You WIN!!");
        else if (personPlay.equals("2"))
           if (computerPlay.equals("1"))
           System.out.println("Scissors cuts paper. You WIN!!");
        else if (computerPlay.equals("0"))
           System.out.println("Rock breaks scissors. You LOSE!!");
        else
           System.out.println("Invalid user input.Computer wins by default. You LOSE!!");
     }
  }
  </pre>