Integer a=3;   =>    Integer a=Integer.valueOf(3);

  /**
*@description: 自动装箱和拆箱
*@auther: yangsj
*@created: 2019/4/2 15:48
*/
@Test
public void Test7(){
//自动装箱:
Integer num = 12;
//自动拆箱:
System.out.println(num + 12);//24
     //基本数据类型的对象缓存:
// -128~127 输出true
// 超过该范围,输出false
Integer num1 = 12;
Integer num2 = 12;
System.out.println(num1 == num2);//true Integer num3 = 129;
Integer num4 = 129;
System.out.println(num3 == num4);//false //手动装箱
Integer num5 = Integer.valueOf(12);
Integer num6 = Integer.valueOf(12);
System.out.println(num5 == num6);//true Integer num7 = Integer.valueOf(128);
Integer num8 = Integer.valueOf(128);
System.out.println(num7 == num8);//false Integer num9 = new Integer(12);
Integer num10 = new Integer(12);
System.out.println(num9 == num10);//false }

最新文章

  1. 使用 SecurityManager 和 Policy File 管理 Java 程序的权限
  2. PHP正则表达式详解(二)
  3. peersim中BT网络核心代码解析
  4. 测试RAC的功能
  5. bzoj 1503 splay
  6. Powershell学习之道-文件夹共享及磁盘映射
  7. 玩转渗透神器Kali:Kali Linux作为主系统使用的正确姿势TIPS
  8. jquery.css 最简单的用法
  9. mysql的乱码问题
  10. 用php逐行读取文件
  11. grep、sed、awk、perl、js、vim等对正则表达式的支持的差别
  12. 【工作笔记一】【转】Visual Studio 2012常用快捷键总结
  13. Shell脚本中让进程休眠的方法(sleep用法)
  14. [Linux] PHP程序员玩转Linux系列-使用supervisor实现守护进程
  15. Lucene41PostingWriter源代码分析
  16. MySQL学习1 - 基本mysql语句
  17. web测试注意点
  18. linux 命令 — 文件相关
  19. golang使用redis
  20. 使用KeePass管理两步验证

热门文章

  1. Linux 系统下的7个运行级别
  2. Samba服务问答
  3. 简历内容-resume
  4. Greg and Array CodeForces 296C 差分数组
  5. A*(A_star)搜索总结
  6. django 中 slice 和 truncatewords 不同用法???
  7. win7 开启 telnet 服务
  8. 通过离线安装包解决了 from cryptography.hazmat.bindings._openssl import ffi, lib ImportError: /usr/local/python36/lib/python3.6/site-packages/cryptography-2.2.2-py3.6-linux-x86_64.egg/cryptography/hazmat/binding
  9. MySQL第五天——日志
  10. 基于cdn方式的vue+element-ui的单页面架构