This error occurs when you try to cast a String object to a Long object, which is not allowed because they are different data types. To fix this error, you need to convert the String to a Long using the Long class's parseLong() method.

Example:

String str = '12345'; Long num = Long.parseLong(str);

Java.lang.String Cannot Be Cast to java.lang.Long: Error Solution and Example

原文地址: https://www.cveoy.top/t/topic/m8Kr 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录