Bellow is snippet of my code. I just want to know why if condition is not being executed even if variable "ans" has value 2020.
private static void solve() throws Exception {
String str="20";
String str1="20";
String ans=str+str1;
if(ans=="2020")
System.out.println("matched");
else System.out.println("Not matched");
System.out.println(ans);
}