Class.forName(driver);
connection=DriverManager.getConnection(url,"root","123456");
statement=connection.createStatement();
resultSet=statement.executeQuery(sql);
User user;
list=new ArrayList<User>();
while(resultSet.next()){
user=new User();
list.add(user);
}
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
}
return list;
user中是这样的
public class User {
private int id;
private String userName;
private String userPsw;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getUserPsw() {
return userPsw;
}
public void setUserPsw(String userPsw) {
this.userPsw = userPsw;
}
怎么输出数据库里的这些内容