基本数据类型的包装类

---------siwuxie095

   

   

   

   

   

1、概述

   

   

   

   

   

   

   

2、为什么使用包装类

   

   

   

   

   

   

3、包装类的常用方法和常量

   

Integer:

   

   

   

Long:

   

   

   

Double:

   

   

   

   

   

   

如:

   

   

   

代码:

 

package com.siwuxie095.test;

   

public class Test04 {

   

public static void main(String[] args) {

System.out.println(Byte.MIN_VALUE+"~"+Byte.MAX_VALUE);

System.out.println(Byte.parseByte("108")+10);//字符串转对应整型

 

System.out.println(Integer.MIN_VALUE+"~"+Integer.MAX_VALUE);

System.out.println(Integer.parseInt("5000")+5);

System.out.println(Integer.toBinaryString(16));//转成二进制(字符串)

System.out.println(Integer.toHexString(16));//转十六进制(字符串)

}

}

   

   

Eclipse中:

   

   

   

运行一览:

   

   

   

   

   

【made by siwuxie095】

原文地址:https://www.cnblogs.com/siwuxie095/p/6527955.html