import java.lang.*;
不知道行吗

解决方案 »

  1.   

    确认userVec.get(i)这里存的时Long类型的吗?
      

  2.   

    确认userVec.get(i)这里存的是Long或long类型的吗?
      

  3.   

    Long只有这两个构造函数;所以你的强制转换是否好用,请确认
    Long(long value) 
              Constructs a newly allocated Long object that represents the specified long argument. 
    Long(String s) 
              Constructs a newly allocated Long object that represents the long value indicated by the String parameter. 
      

  4.   

    java.lang.ClassCastException
    就是说userVec.get(i)返回的对象不能转换成Long对象
    也就是这个对象并不是Long对象, 至于是什么对象你应该清楚呀
    也可能是循环时返回null了
      

  5.   

    Long l = (Long)(userVec.get(i));
    long a=l.longValue();看看是否是第一句有误,否则检查userVec.get(i)是否真是Long,或者userVec.get(i)就是为null