java.lang.Integer源码精读(一)
JDK源码精读汇总帖 类声明 public final class Integer extends Number implements Comparable<Integer> {} public abstract class Number implements java.io.Serializable {} 抽象类 Number 是 BigDecimal、BigInteger、Byte、Double、Float、Integer、Long 和 Short 类的超类。 Number 的子类必须提供将表示的数值转换为 byte、double、float、int、long 和 short 的方法。 Integer中对应的方法就是类型转换,将int转换成byte、double、float、long 和 short 类型。 compareTo 实现了Comparable,看看对应的方法,很好理解 public int compareTo(Integer anotherInteger) { return compare(this.value, anotherInteger.value...