首页 > 其他 > 详细

String当中的intern()

时间:2019-12-14 13:40:04      阅读:91      评论:0      收藏:0      [点我收藏+]

 

public class String001 {
	public static void main(String[] args) {
		String s1 = "hello";
		String s2 = new String("hello");
		String s3 = new String("hello").intern();
		
		System.out.println(s1 == s2); //false
		System.out.println(s1 == s3); //true	
	}
}

  

技术分享图片

 

String当中的intern()

原文:https://www.cnblogs.com/wgDream/p/12038770.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!