public class Student {
public String name;
public int age;
public int grade;
public Student(String name, int age, int grade) {
this.name = name;
this.age = age;
this.grade = grade;
}
public boolean equals(Student s) {
return this.grade == s.grade;
}
public String toString() {
return "姓名" + this.name + "年龄" + this.age + "成绩" + this.grade;
}
}public class stuTest {
/**
* @param args
*/
public static void main(String[] args) {
Student s=new Student("张三",18,89);
System.out.println(s);
System.out.println(s.toString());
Student s1=new Student("李四",20,88);
System.out.println(s1);
System.out.println(s1.toString());
public String name;
public int age;
public int grade;
public Student(String name, int age, int grade) {
this.name = name;
this.age = age;
this.grade = grade;
}
public boolean equals(Student s) {
return this.grade == s.grade;
}
public String toString() {
return "姓名" + this.name + "年龄" + this.age + "成绩" + this.grade;
}
}public class stuTest {
/**
* @param args
*/
public static void main(String[] args) {
Student s=new Student("张三",18,89);
System.out.println(s);
System.out.println(s.toString());
Student s1=new Student("李四",20,88);
System.out.println(s1);
System.out.println(s1.toString());