String S1="He";
String S2="llow";
String S3="Hellow";
String S4="He"+"llow";
String S5=S1+S2;
System.out.println(S3==S4);
System.out.println(S5==S3);
System.out.println(S5==S4);
why S5 is not referring object from constant pool? since S3 and S4 are in pool thats why giving true on S3==S4 but in case of S5==S3 & S5==S4 result is false,means S5 is not in pool.
Aucun commentaire:
Enregistrer un commentaire