When I run the following code
public class Test {
public static void main(String[] args) {
System.out.println(args[0]);
System.out.println("testing");
System.out.println(args[0] == "testing");
}
}
using
java Test testing
at the command line, it prints the following:
testing
testing
false
Why is the third printed line not 'true' when printed lines 1 and 2 seem to be the same?
Edit: Thanks for your replies - that's answered my query. I have a follow up query, which is: if == compares the String references, how can I find out what those references are?