如何通过将float转换为String来解决此错误,
我的代码在这里

private StudentBean prepareStudentBean(Student student){
    StudentBean bean = new StudentBean();
    bean.setStdId(student.getStdId());
    bean.setStdName(student.getStdName());
    bean.setStdClass(student.getStdClass());
    bean.setStdGPA(student.getStdGPA());
    return bean;
}


StudentBean类型的setStdGPA(Float)方法不适用于参数(字符串)

最佳答案

尝试这个

bean.setStdGPA(Float.valueOf(student.getStdGPA());

10-08 01:43