I\'ve been trying to get the string initialize, but to no avail. I have tried all of the solutions I have come across and I am not sure whether it is because of my ineptness or
String computer; // not initialized
change this to
String computer = null; or ""// initialized
if (player.compareTo(computer) == 0)
because, the variable computer will assigned based on the condition. If the above condition you mentioned is not satisfied. The value is none, so only it show the error.