Invisible characters in Java Strings

前端 未结 2 849
灰色年华
灰色年华 2020-12-20 14:06
String a = \"Hello\\u200e\";
String b = \"Hello\\u200f\";

System.out.println(\"a = \'\" + a + \"\' and b = \'\" + b + \"\' are length \"
                     + a.le         


        
2条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-20 14:29

    Because the character sequences are not identical. Just because it appears the same on the console does not mean the objects are identical.

提交回复
热议问题