当前位置: 首页 > news >正文

P459 包装类Wrapper

包装类的分类

1)针对八种基本数据类型相应的引用类型——包装类。

2)有了类的特点,就可以调用类中的方法。

Boolean包装类 

 

Character包装类 

 

其余六种Number类型的包装类 

 

包装类和基本数据类型的相互转换 

public class Integer01 {public static void main(String[] args) {//演示 int <--> Integer 的装箱和拆箱//jdk5前是手动装箱和拆箱//手动装箱 int --> Integerint n1 = 100;//Integer integer = new Integer(n1);Integer integer1 = Integer.valueOf(n1);//手动拆箱 Integer --> intint i = integer1.intValue();//jdk5后就可以自动装箱和拆箱int n2 = 200;//自动装箱 int --> IntegerInteger integer2 = n2; //底层使用的仍然是Integer.valueOf(n2)//自动拆箱 Integer --> intint n3 = integer2; //底层使用的仍然是integer1.intValue()}
}
http://www.lryc.cn/news/357470.html

相关文章:

  • Kong网关的负载均衡
  • 这是一个逗号
  • oracle tree
  • react-beautiful-dnd 横纵排序demo
  • web练习
  • 模型蒸馏笔记
  • HAL库使用FreeRTOS实时操作系统时配置时基源(TimeBase Source)
  • 如何让你的网站能通过域名访问
  • Spring Boot + Spring Security + JWT 从零开始
  • 【busybox记录】【shell指令】rmdir
  • [LitCTF 2023]yafu (中级) (素数分解)
  • MySQL alter 语句
  • 列表推导式(解析式)python
  • YOLO-10更快、更强
  • 新火种AI|寻求合作伙伴,展开豪赌,推出神秘AI项目...苹果能否突破AI困境?
  • MFC工控项目实例一主菜单制作
  • 代码随想录-Day22
  • uniapp项目 使用vue-plugin-hiprint静默打印功能
  • 视频汇聚EasyCVR视频监控平台GA/T 1400协议特点及应用领域解析
  • 基于似然场的快速避障算法
  • Flutter 中的 IndexedStack 小部件:全面指南
  • 基于51单片机的交通灯设计
  • ECMAScript 详解
  • 使用Java Swing制作一个飞翔的小鸟游戏
  • leetcode 684.冗余连接
  • RestTemplet 自定义消息转换器总结
  • 贝叶斯算法:机器学习中的“黄金法则”与性能提升之道
  • element-ui 实现输入框下拉树组件(2024-05-23)
  • Nginx 相关使用
  • 基于Python实现 HR 分析(逻辑回归和基于树的机器学习)【500010104】