基本数据类型的包装类

    xiaoxiao2021-03-25  107

    ---------siwuxie095

      

      

      

      

      

    1、概述

      

      

      

      

      

      

      

    2、为什么使用包装类

      

      

      

      

      

      

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

      

    Integer:

      

      

      

    Long:

      

      

      

    Double:

      

      

      

      

      

      

    如:

      

      

      

    代码:

     

    package com.siwuxie095.test;

      

    public class Test04 {

      

    public staticvoid 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://ju.6miu.com/read-16489.html

    最新回复(0)