student.java

来自「自己编写的Java学习代码」· Java 代码 · 共 34 行

JAVA
34
字号
public class Student
{
	int id;
	String name;
	public Student(int id,String name){
		this.id=id;
		this.name = name;
	}
	public String toString(){
		return id+"  "+name;
	}

	public boolean equals(Object o){
		if(o==null){
			return false;
		}
		if(this == o){
			return true;
		}
		if(o instanceof Student){
			Student s1 = (Student)o;
			if(s1.id==this.id){
				return true;
			}else{
				return false;
			}
		}else{
			return false;
		}
	}
	public int hashCode(){
		return id;
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?