Possible Duplicate:
How do I compare strings in Java?
I'm sorry for this rather simple question. I have this very simple java program:
public class ArgIt {
public static void main(String[] args){
if(args[0].equals("x")) System.out.print("x");
if(args[0] == "x") System.out.println("x2 ");
}
}
If I call the program >java ArgIt x it only prints a single x. Why will the program not acknowledge the == on the string when in any other circumstances it does?