The method getstuID() in the type people is not applicable for the arguments (String)

getstuID()出现了标题这个错误

我的 people 类

public class people {
    private String stuID;
    private String name;
    private int score;
    
    people(){}
    
    public String getstuID() {
        return this.stuID;
    }
    public void setstuID(String id) {
          this.stuID = id;
    }
    
    public String getname() {
        return this.name;
    }
    
    public void setname(String name) {
          this.name = name;
    }
    
    public int getscore() {
        return this.score;
    }
    
    public void setscore(int score) {
        this.score = score;
    }

    

    
}

下面的是我出错的那个类

import java.sql.*;
import java.util.ArrayList;
import java.util.List;

public class idea {
    private static idea instance = new idea();
    public static idea getInstance() {
        return instance;
    }
    
    private idea() {}
    public boolean saveStudent(people stu) {
        boolean result = false;
        Connection conn = null;
        
        try {
            conn = JdbcAccess.getConnection();
            String sqlInset = "insert into CJGL.student(stuID, Name, score) values(?, ?, ?)";
            PreparedStatement stmt = conn.prepareStatement(sqlInset);
            
            stmt.setString(1, stu.getstuID());
            stmt.setString(2, stu.getname());
            stmt.setInt(3, stu.getscore());
            int i = stmt.executeUpdate();
            if(i==1) {
                result = true;
            }
        }catch(SQLException e) {
            e.printStackTrace();
        }finally {
            try {
                conn.close();
            }catch(SQLException e) {
                e.printStackTrace();
            }
        }
        return result;
        
    }
    
    public List<people> selectPeople(){
        List<people> peoList = new ArrayList<people>();
        Connection conn = null;
        try {
        conn = JdbcAccess.getConnection();
        Statement stmt = conn.createStatement();
        ResultSet rs = stmt.executeQuery("select * from CJGL.student");
        while(rs.next()) {
            people stu = new people();
            stmt.setstuID(1, stu.getstuID("ID"));
            stmt.setname(2, stu.getname("name"));
            stmt.setscore(3, stu.getscore("score"));
            peoList.add(stu);
            
        }
    }catch(Exception e) {
         e.printStackTrace();
    }finally {
        try {
            conn.close();
        }catch(SQLException e) {
             e.printStackTrace();
        }
    }
        return peoList;
}
}

img

我的解答思路和尝试过的方法

我试过直接点那个

img


然后错误就去到setstuID()那边了

楼主是初学者,这该咋整

代码写反了,修改如下:

while(rs.next()) {
            people stu = new people();
            stu.setstuID(rs.getString("ID"));
            stu.setname(rs.getString("name"));
            stu.setscore(rs.getInt("score"));
            peoList.add(stu);
            
        }

img

错的那个代码块主要是想达到查询数据库里的数据的效果