所以,我在 Java 中工作,试图将 ajava.sql.ResultSet
转换为我自己的类MyResultSet
这是代码:MyResultSet.java
public class MyResultSet implements java.sql.ResultSet{
//There are a bunch of Implemented Methods here. None of them have any custom code, They are all unchanged. Just didn't want to put huge code in here.
}
我试图用来转换它的代码
ResultSet r = getResultSet();
return (MyResultSet)r;
每当我运行它时,我都会得到一个“ClassCastException”。
有人可以向我解释如何转换为实施类吗?