I understand and know why you typically have to use == to compare strings in java, but for some reason I am able to do it in Eclipse. My code is Code:
public class Test{
public static void main(String [] args){
String str1 = "string";
if(str1 == "string"){
System.out.println("wtf");
}
}
}
Why does this print "wtf" yet using javac from command line does not?