Hello, I am making a simple little game in java, and I want to make a BASIC AI for it. I need it to chose one of three classes, which I'm having it do by generating 3 numbers, and then according to what number is generated, depends on what class is chosen.

Here's the code I have so far:

Code:
String p2_class;
System.out.println("press any key");
p2_class = (stdin.readLine()).toLowerCase();


System.out.println("You have three choices of classes. You can either be: water, earth, or fire");
System.out.println("Player two, your choice is?");

//builds class choice AI
Random a = new Random();
int AI_class = a.nextInt(2);

if(AI_class == 0)
{
p2_class.equals("water");
}
if(AI_class == 1)
{
p2_class.equals("fire");
}
if(AI_class == 2)
{
p2_class.equals("earth");
}

System.out.println("Right! player two chose " + p2_class);
Right now unless I put the line:
Code:
p2_class = (stdin.readLine()).toLowerCase();
I get the error:
Code:
EmptyFrame1.java:96: variable p2_class might not have been initialized
p2_class.equals("water");
^
The problem is that when I use the line
Code:
p2_class = (stdin.readLine()).toLowerCase();
the AI can't change the p2_class for some reason


Does anyone know how to fix this?

Bananas.