import java.sql.SQLOutput;
import java.util.Objects;
public class Student {
private String name;
private int no;
private int age;
private String addr;
public Student() {
}
public Student(String name, int no, int age, String addr) {
this.name = name;
this.no = no;
this.age = age;
this.addr = addr;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getNo() {
return no;
}
public void setNo(int no) {
this.no = no;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public String getAddr() {
return addr;
}
public void setAddr(String addr) {
this.addr = addr;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Student student = (Student) o;
return no == student.no && age == student.age && Objects.equals(name, student.name) && Objects.equals(addr, student.addr);
}
@Override
public int hashCode() {
return Objects.hash(name, no, age, addr);
}
@Override
public String toString() {
return "Student{" +
"name='" + name + '\'' +
", no=" + no +
", age=" + age +
", addr='" + addr + '\'' +
'}';
}
public void xuexi(String name){
System.out.println(name + "学习");
}
public void call(String name){
System.out.println(name + "打电话");
}
public void play(String name){
System.out.println(name + "打游戏");
}
public static void main(String[] args) {
Student student = new Student("lisi",10,20,"东莞");
student.play("老登儿");
student.call("gaba");
student.xuexi("jjj");
System.out.println(student.getAddr());
System.out.println(student.getName());
System.out.println(student.getAge());
}
}
软件一班08叶思宏
最新推荐文章于 2024-09-03 20:17:53 发布