博客
关于我
java中自动装箱的问题
阅读量:419 次
发布时间:2019-03-06

本文共 499 字,大约阅读时间需要 1 分钟。

package wrapper;public class WrapperDemo {    public static void main(String[] args) {        Integer a=new Integer(5);        Integer b=new Integer(5);        System.out.println(a==b);        System.out.println(a.equals(b));        /*           false           true        */        Integer c=127;//属于自动装箱        Integer d=127;//jdk1.5以后,如果装箱的是一个字节,那么该数据会被共享,不会被重新开辟空间        System.out.println(c==d);        System.out.println(c.equals(d));        /*           true           true         */    }}

 

转载地址:http://kzeuz.baihongyu.com/

你可能感兴趣的文章
80. Remove Duplicates from Sorted Array II
查看>>
83. Remove Duplicates from Sorted List
查看>>
410. Split Array Largest Sum
查看>>
Vue3发布半年我不学,摸鱼爽歪歪,哎~就是玩儿
查看>>
《实战java高并发程序设计》源码整理及读书笔记
查看>>
Java开源博客My-Blog(SpringBoot+Docker)系列文章
查看>>
程序员视角:鹿晗公布恋情是如何把微博搞炸的?
查看>>
Spring+SpringMVC+MyBatis+easyUI整合进阶篇(七)一次线上Mysql数据库崩溃事故的记录
查看>>
【JavaScript】动态原型模式创建对象 ||为何不能用字面量创建原型对象?
查看>>
ClickHouse源码笔记4:FilterBlockInputStream, 探寻where,having的实现
查看>>
Linux应用-线程操作
查看>>
多态体验,和探索爷爷类指针的多态性
查看>>
系统编程-进程间通信-无名管道
查看>>
记2020年初对SimpleGUI源码的阅读成果
查看>>
C语言实现面向对象方法学的GLib、GObject-初体验
查看>>
系统编程-进程-ps命令、进程调度、优先级翻转、进程状态
查看>>
为什么我觉得需要熟悉vim使用,难道仅仅是为了耍酷?
查看>>
一个支持高网络吞吐量、基于机器性能评分的TCP负载均衡器gobalan
查看>>
HDOJ2017_字符串统计
查看>>
高等软工第二次作业《需求分析阶段总结》
查看>>