package StudentMange;
/*
16. 定义用户类 User 包含以下属性 姓名 name(String),年龄 age(int),
用户名username(String),密码 password(int) 完成以下功能
(1) 定义User方法以及其属性,完成get/set方法和空参有参构造
(2) 创建测试类Test,完成以下功能
① 创建4个User对象,并初始化值
② 将4个对象存到List集合中并遍历打印,如图
③ 查找集合中是否存在用户名为 “小黑”,并且密码为“123456”的人, 如果有请打印对应的用户,结果如图一,如果不存在打印结果如图二;
*/
public class User {
private String name;
private int age;
private String username;
private int password;
public User() { } public User(String name, int age, String username, int password) { this.name = name; this.age = age; this.username = username; this.password = password; } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public int getPassword() { return password; } public void setPassword(int password) { this.password = password; }
}