* 由于基本数据类型只能做一些简单的操作和运算,所以Java为我们封装了基本数据类型,为每种基本数据类型提供了包装类
* 包装类就是封装了基本数据类型的类,为我们提供了更多复杂的方法和一些变量

*
* byte Byte
* short Short
* char Character
* int Integer
* long Long
* float Float
* double Double
* boolean Boolean

* Integer:

* 构造方法:
* Integer(int value) int-- Integer
* Integer(String s) String--Integer * String --- int
* 方式1:
    Integer(String s) 对象的intValue()方法
*    int intValue()
*
* 方式2:
    static int parseInt(String s)
*
*
* int --- String
* 方式1: + ""
*
* 方式2:String toString()
* static String toString()

  

public class IntegerDemo {
public static void main(String[] args) { //String --- int
Integer i = new Integer("10");
int a = i.intValue();
System.out.println(a+10); int b = Integer.parseInt("5");
System.out.println(b+12); //int --- String
Integer i2 = new Integer(1);
String c = i2.toString();
System.out.println(c+21);//字符串的拼接 int d = 1;
String e = d + "";
System.out.println(e+212);//字符串的拼接
}
}

输出

28.5 Integer-- int的包装类的更多相关文章

  1. Java中 int和Integer的区别+包装类

    --今天用Integer 和Integer 比较 发现有问题,于是去查了查. 1.Java 中的数据类型分为基本数据类型和引用数据类型 int是基本数据类型,Integer是引用数据类型: Inget ...

  2. int和Integer的区别?包装类?装箱?拆箱?

    int和Integer的区别: 1) int是基本数据类型,直接存储的数值,默认是0; 2) Integer 是int的包装类,是个对象,存放的是对象的引用,必须实例化之后才能使用,默认是null; ...

  3. Java学习_int和Integer的区别+包装类

    1.Java 中的数据类型分为基本数据类型和引用数据类型 int是基本数据类型,Integer是引用数据类型: Ingeter是int的包装类,int的初值为0,Ingeter的初值为null. 2. ...

  4. list<Integer>,Integer[],int[]之间的互转(jdk1.8)

    偶然在开发过程中需要将int[] 转成 List<Integer>,采用了遍历的方式,写的代码实在太多. List<Integer> list = new ArrayList& ...

  5. String,Integer,int类型之间的相互转换

    String, Integer, int 三种类型之间可以两两进行转换 1. 基本数据类型到包装数据类型的转换 int -> Integer (两种方法) Integer it1 = new I ...

  6. 关于Integer 和Double包装类创建对象时的底层解析

    public void method1() { Integer i = new Integer(1); Integer j = new Integer(1); System.out.println(i ...

  7. IntegerCache缓存占用堆、栈、常量池的问题,自动拆装箱的基本概念,Integer==int时的问题说明

    原创声明:作者:Arnold.zhao 博客园地址:https://www.cnblogs.com/zh94 先普及一个基本概念:Java中基本数据类型的装箱和拆箱操作 自动装箱 在JDK5以后,我们 ...

  8. Integer & int & == & equals

    int 是基本类型,直接存数值,integer是对象,用一个引用指向这个对象 int 是基本数据类型,Integer是类 int类的变量初始为0,Integer的变量则初始化为null. 如果只是用来 ...

  9. mysql Integer Types (Exact Value) - INTEGER, INT, SMALLINT, TINYINT, MEDIUMINT, BIGINT

    使用mysql的时候,用到int类型的蛮多,需要注意一下: 1. 值的范围 Type Storage Minimum Value Maximum Value   (Bytes) (Signed/Uns ...

  10. Java中List, Integer[], int[]的相互转换

    import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; public class Mai ...

随机推荐

  1. annaconda的安装及使用

    一.安装 1.安装包下载: 方式1:官网:https://www.anaconda.com/distribution/ 方式2:清华镜像源:https://mirrors.tuna.tsinghua. ...

  2. Spring Boot + LayUI 批量修改数据 数据包含着对象

    页面展示 HTML 代码 <blockquote class="layui-elem-quote demoTable"> <div class="lay ...

  3. 《Explaining and harnessing adversarial examples》 论文学习报告

    <Explaining and harnessing adversarial examples> 论文学习报告 组员:裴建新   赖妍菱    周子玉 2020-03-27 1 背景 Sz ...

  4. DRF之restful规范、Postman接口测试

    一. DRF简介 Django REST框架是一个功能强大且灵活的工具包,用于构建Web API. 使用REST框架的一些原因: 该网站可浏览API是你的开发人员一个巨大的可用性胜利. 身份验证策略包 ...

  5. openfire广播broadcast插件怎么发送消息给所有用户(包括在线和离线)

    openfire广播broadcast插件怎么发送消息给所有用户(包括在线和离线): 打开openfire管理界面,找到服务器系统属性,添加一个属性(属性名:plugin.broadcast.all2 ...

  6. 动态规划(Dynamic Programming)算法与LC实例的理解

    动态规划(Dynamic Programming)算法与LC实例的理解 希望通过写下来自己学习历程的方式帮助自己加深对知识的理解,也帮助其他人更好地学习,少走弯路.也欢迎大家来给我的Github的Le ...

  7. Spark使用jdbc时的并行度

    Spark SQL支持数据源使用JDBC从其他数据库读取数据. 与使用JdbcRDD相比,应优先使用此功能. 这是因为结果以DataFrame的形式返回,并且可以轻松地在Spark SQL中进行处理或 ...

  8. CSS 常用属性之 阴影

    text-shadow 是一个给文字添加阴影的属性 text-shadow: X偏移量,Y偏移量,模糊值,颜色  可以同时设置多个文本阴影,需要用逗号隔开 如果是需要兼容低版本的浏览器 -webkit ...

  9. iOS 性能优化收集

    iOS 性能调试 instrument Instrument Instrument之Core Animation工具 避免图层混合 ①.确保控件的opaque属性设置为true,确保backgroun ...

  10. Codeforces 1329C - Drazil Likes Heap(堆+贪心)

    题目链接 题意 给出一个高度为 h 的大根堆, 要求弹出其中若干个数后高度变为 g, 并且前后大根堆都是满二叉树. 问新的大根堆所有数之和的最小值, 并要给出一种弹出数的操作序列(节点序号). h, ...