大家好,我不知道代码中的问题在哪里,你能帮我吗。错误1:usersdao不是抽象的,并且不重写daolist中的抽象方法delete。错误2:方法不重写或实现父类型@override中的方法
usersdao.java文件:
public class Users extends db implements DaoList<Users>{
private static UsersDao userDao;
private UsersDao(){
}
public static UsersDao getInstance(){
if(userDao == null){
userDao = new UsersDao();
}
return userDao;
}
@Override
public List<UsersVo> loadAll(Users u) throws Exception {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public int insert(Users u) throws Exception {
Connection con = null;
PreparedStatement ps = null;
int count = 0;
try{
con = getConnection();
String sql = "INSERT INTO USERS(USERNAME,PASSWORD,EMAIL) VALUES(?,?,?)";
ps = con.prepareStatement(sql);
ps.setString(1, u.getUserName());
ps.setString(2, u.getPassWord());
ps.setString(3, u.getEmail());
count = ps.executeUpdate();
}catch(Exception ex){
}finally{
ps.close();
closeConnection(con);
}
return count;
}
@Override
public int update(Users u) throws Exception {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public int delete(Users u) throws Exception {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public PatientsVo getData(Users u) throws Exception {
throw new UnsupportedOperationException("Not supported yet.");
} }
1条答案
按热度按时间kadbb4591#
错误告诉您确切的问题-您的代码正在尝试
@Override
在其超类或实现的接口中不存在的方法。这个
UsersDao
实现类具有:鉴于
DaoList
您正在实现的接口具有:方法签名不同(即
UserVo
参数),接口应为:(其他方法同上)