Advertisement
Guest User

student class

a guest
Mar 22nd, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. package p2;
  2.  
  3. import person.Car;
  4. import person.Person;
  5.  
  6. public class Student extends Person implements Helper{
  7.  
  8. int studentId;
  9.  
  10. public Student(int id, String name,int studentId) {
  11. super(id, name);
  12.  
  13. this.studentId = studentId;
  14. }
  15.  
  16. @Override
  17. public void show(int d) throws Exception{
  18.  
  19. super.show(23);
  20. System.out.println(this.studentId);
  21.  
  22.  
  23. }
  24.  
  25. @Override
  26. public void show2(int s) {
  27.  
  28. System.out.println("dhdh");
  29.  
  30. }
  31.  
  32. @Override
  33. public int compareTo(Helper o) {
  34. if(this.getId()>((Student)o).getId())
  35. return 1;
  36. if(this.getId()<((Student)o).getId())
  37. return -1;
  38.  
  39. return 0;
  40. }
  41.  
  42.  
  43. @Override
  44. public String toString() {
  45. // TODO Auto-generated method stub
  46. return this.getName()+" "+this.getId()+"\n";
  47. }
  48.  
  49.  
  50.  
  51.  
  52.  
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement