zoukankan      html  css  js  c++  java
  • WrapperClass

    * 测试包装类的基本用法;
    * 包装类就是把基本属性也变成对象,方便有时候用;
    * 八种基本属性,其他类型类似于integer,除了int-integer和char-character;其他都是原样;
    * @author xu-saozhu
    *实际上Java lang包里有Wrapper包装类,里面有个抽象类number,八种基本属性就是根据这个number类来重写得到的。

     1 public class WrapperClass {
     2     public static void main(String[]args){
     3         Integer i=new Integer(1000);//这样把1000包装成一个对象了
     4         System.out.println(Integer.MAX_VALUE);//最大的数
     5         System.out.println(Integer.toHexString(i));//把1000转换为16进制
     6         Integer i2=Integer.parseInt("234");//把字符串转换为数
     7         System.out.println(i2+10);// 应该输出244
     8         Integer i3=new Integer("233");//也是直接转换为数字
     9         String str=123+"";//数字转换成字符串;
    10     }
    11 }
  • 相关阅读:
    php基础语言
    cookie和setting
    php数据连接
    php连接sql
    php提交
    今天学习了php的数据类型
    第一天进入php,这只是自己的一个心情
    02-07 (2) 自连接
    内连接 和左连接查询 02-07 (1)
    out 和ref 的区别
  • 原文地址:https://www.cnblogs.com/myErebos/p/8588236.html
Copyright © 2011-2022 走看看