Bellow是我的代码片段。我只是想知道,如果条件没有被执行;ans";具有价值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);
}
ans.equals("2020")
这应该行得通。