zoukankan      html  css  js  c++  java
  • java数据类型

    java中有几种特殊的类型String, Array,Enum, 属于Object,派生出来的, 但是String可以做加法, 另外两个可以花括号定义初值;

    primitive type(基本值类型) VS Object type(对象类型)

    装包和拆包

    /**
         * Returns an {@code Integer} instance representing the specified
         * {@code int} value.  If a new {@code Integer} instance is not
         * required, this method should generally be used in preference to
         * the constructor {@link #Integer(int)}, as this method is likely
         * to yield significantly better space and time performance by
         * caching frequently requested values.
         *
         * This method will always cache values in the range -128 to 127,
         * inclusive, and may cache other values outside of this range.
         *
         * @param  i an {@code int} value.
         * @return an {@code Integer} instance representing {@code i}.
         * @since  1.5
         */
        public static Integer valueOf(int i) {
            if (i >= IntegerCache.low && i <= IntegerCache.high)
                return IntegerCache.cache[i + (-IntegerCache.low)];
            return new Integer(i);
        }

    .valueOf ()  两个进行比较可能等也可能不等。

    另外在进行

    数值初始化的时候数组可以直接输出值, 比如int[] 可以对某一个值输出0,

    而int a;  直接使用会编译错误;

  • 相关阅读:
    添加活动记录的小坑
    用windows的批处理文件批量更改文件后缀
    js日期的初始化的格式
    对象的继承
    关于换行字符的问题
    js获取dom对象style样式的值
    判断邮箱是否合法
    Python控制函数运行时间
    如何用python编写一个计时器的程序
    TF-IDF算法介绍及实现
  • 原文地址:https://www.cnblogs.com/wangnuo/p/7728804.html
Copyright © 2011-2022 走看看