I'm a complete Java noob. This code runs fine with no compiling errors, but when I stepped through the program I discovered that the if statements at the bottom never evaluated to true. What am I missing?
import java.util.Scanner;
public class rps {
public static void main(String args[]) {
Scanner scanner = new Scanner(System.in);
println("Select rock (0), paper (1), or scissors (2)");
String input = scanner.nextLine();
if (Integer.parseInt(input) < 0 || Integer.parseInt(input) > 2) {
input = Long.toString(Math.round(Math.random() * 2));
}
if (input == "0") {
println("You played rock");
} else if (input == "1") {
println("You played paper");
} else if (input == "2") {
println("You played scissors");
}
}
static void println(String a) {
System.out.println(a);
}
}