This repository acts as a personal archive for my solutions to EdX course *Data Structures and Software Design* from PennX.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
667 B

  1. /*
  2. * SD2x Homework #10
  3. * This class represents a student.
  4. * Please do not change this code! Your solution will be evaluated using this version of the class.
  5. */
  6. public class Student {
  7. protected String name;
  8. public Student(String name) {
  9. this.name = name;
  10. }
  11. public String getName() {
  12. return name;
  13. }
  14. @Override
  15. public boolean equals(Object obj) {
  16. if (this == obj)
  17. return true;
  18. if (obj == null)
  19. return false;
  20. if (getClass() != obj.getClass())
  21. return false;
  22. Student other = (Student) obj;
  23. if (name == null) {
  24. if (other.name != null)
  25. return false;
  26. } else if (!name.equals(other.name))
  27. return false;
  28. return true;
  29. }
  30. }