码迷,mamicode.com
首页 > 编程语言 > 详细

java8 String intern()

时间:2019-12-15 18:19:05      阅读:108      评论:0      收藏:0      [点我收藏+]

标签:static   inter   ==   out   rgs   col   java8   ati   system   

public class Solution {


  public static void main(String[] args) {
    String a = new String("he")+new String("llo");
    System.out.println(a == a.intern());
    String b = "hello";
    System.out.println(a == b);
    System.out.println(a == "hello");
    System.out.println(b == "hello");
  }
}

true
true
true
true

java8 String intern()

标签:static   inter   ==   out   rgs   col   java8   ati   system   

原文地址:https://www.cnblogs.com/tonggc1668/p/12045156.html

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