Java小项目之:校园注册登录系统!
相信很多学校都有自己的网站,而且还有学生课表成绩查询的系统,和教师端的操作系统。今天教大家做一个简单的注册登录系统!
代码展示:
package com.entity;
public class Teacher {
private int id;
private String name;
private String sex;
private int age;
public Teacher(){
super();
}
public Teacher(int id, String name) {
super();
this.id = id;
this.name = name;
}
public Teacher(int id, String name, String sex, int age) {
super();
this.id = id;
this.name = name;
this.sex = sex;
this.age = age;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getSex() {
return sex;
}
public void setSex(String sex) {
this.sex = sex;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public String toString() {
return “教师 工号:” + id + " 姓名:" + name + " 性别:" + sex
+ " 年龄:" + age;
}
public int hashCode() {
return id;
}
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if(obj instanceof Teacher){
Teacher other=(Teacher)obj;
return id==other.id&&name.equals(other.name);
}
return false;
}
}
喜欢这样文章的可以关注我,我会持续更新,你们的关注是我更新的动力!需要更多java学习资料的也可以私信我!
祝关注我的人都:身体健康,财源广进,福如东海,寿比南山,早生贵子,从不掉发!