回复你的上一条评论:只需仔细检查,该对象实际上是Integer类型,然后使用自动装箱(我假设您的编译器级别为1.5+):
Object o = getTheValue();
int result = 0; // we have to initialize it here!
if (o instanceof Integer) {
  result = (Integer) o;
} else {
  throw new WTFThisShouldHaveBeenIntegerException();
}
| 归档时间: | 
 | 
| 查看次数: | 15211 次 | 
| 最近记录: |