码迷,mamicode.com
首页 > 其他好文 > 详细

String当中的intern()

时间:2019-12-14 13:42:38      阅读:62      评论:0      收藏:0      [点我收藏+]

标签:ima   java   print   string   idt   图片   img   highlight   ring   

 

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()

标签:ima   java   print   string   idt   图片   img   highlight   ring   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!