首页 > 代码库 > Object类型转换为long或者Long

Object类型转换为long或者Long

1.转换为long

Object o = new Object();
long l = Long.valueOf(String.valueOf(o)).longValue();

 

2.转换为Long

Object o = new Object();
long l = Long.valueOf(String.valueOf(o));

Object类型转换为long或者Long