什么时候应该在字符串文本上使用字符串的Intern方法?
intern
String s1 = "Rakesh";String s2 = "Rakesh";String s3 = "Rakesh".intern();if ( s1 == s2 ){
System.out.println("s1 and s2 are same"); // 1.}if ( s1 == s3 ){
System.out.println("s1 and s3 are same" ); // 2.}s1 and s3 are sames1 and s2 are sameintern
长风秋雁
茅侃侃
慕仙森
随时随地看视频慕课网APP
相关分类