暑期熔炉7月18

新语言 旧语言 该怎么回答 不眠的时间

笔记

表 1 Integer类中的常用方法
方法返回值功能
byteValue() byte 以 byte 类型返回该 Integer 的值
shortValue() short 以 short 类型返回该 Integer 的值
intValue() int 以 int 类型返回该 Integer 的值
toString() String 返回一个表示该 Integer 值的 String 对象
equals(Object obj) boolean 比较此对象与指定对象是否相等
compareTo(Integer
anotherlnteger)
int 在数字上比较两个 Integer 对象,如相等,则返回 0;
如调用对象的数值小于 anotherlnteger 的数值,则返回负值;
如调用对象的数值大于 anotherlnteger 的数值,则返回正值
valueOf(String s) Integer 返回保存指定的 String 值的 Integer 对象
parseInt(String s) int 将数字字符串转换为 int 数值

 

Integer 类包含以下 4 个常量。

 

MAX_VALUE:值为 231-1 的常量,它表示 int 类型能够表示的最大值。

MIN_VALUE:值为 -231 的常量,它表示 int 类型能够表示的最小值。

SIZE:用来以二进制补码形式表示 int 值的比特位数。

TYPE:表示基本类型 int 的 Class 实例。

posted @ 2023-07-22 16:20  混沌武士丞  阅读(10)  评论(0)    收藏  举报