注册 登录
编程论坛 JAVA论坛

关于Integer.valueOf()从缓存池取对象的用法

疯狂的小a 发布于 2018-10-05 10:13, 1790 次点击
package com.xiaoa;

/**
 * @Auther: xiaoa
 * @Date: 2018.10.5 09:51
 * @Description:关于Integer.valueOf()从缓存池取对象的用法
 */
public class TestInteger {
    public static void main(String[] args) {
        final Integer a = new Integer(55);
        final Integer b = new Integer(55);
        System.out.println(a == b);
        final Integer c = Integer.valueOf(55);
        System.out.println(a == c);
        final Integer d = Integer.valueOf(55);
        System.out.println(c == d);
    }
}
1 回复
#2
幻紫灵心2018-10-05 12:44
1