①特性
- Integer类不能被继承
- Integer类实现了Comparable接口,所以可以用compareTo进行比较并且Integer对象只能和Integer类型的对象进行比较,不能和其他类型比较
- Integer继承了Number类,所以该类可以调用longValue、floatValue、doubleValue等系列方法返回对应的类型的值
②方法
- compareTo(Integer anotherInteger)
- equals(Object obj)
- byteValue()
- doubleValue()
- floatValue()
- intValue()
- shortValue()
- longValue()
- toString()
③示例
@Test
public void test1() {
Integer integer = 12;
System.out.println(integer.equals(12));
System.out.println(integer.compareTo(11));
System.out.println(integer.toString());
System.out.println(integer.byteValue());
System.out.println(integer.floatValue());
System.out.println(integer.intValue());
System.out.println(integer.longValue());
System.out.println(integer.shortValue());
}