Guest User

Untitled

a guest
May 26th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. import java.io.*;
  2.  
  3. @SuppressWarnings("serial")
  4. public class Student implements Serializable {
  5.  
  6. private String ime;
  7. private String prezime;
  8. private int indeks;
  9.  
  10. public Student() {
  11. ime = "Nepoznato";
  12. prezime = "Nepoznato";
  13. indeks = -1;
  14. }
  15.  
  16. public Student(String ime, String prezime, int indeks) {
  17. super();
  18. this.ime = ime;
  19. this.prezime = prezime;
  20. this.indeks = indeks;
  21. }
  22.  
  23. public String getIme() {
  24. return ime;
  25. }
  26.  
  27. public void setIme(String ime) {
  28. this.ime = ime;
  29. }
  30.  
  31. public String getPrezime() {
  32. return prezime;
  33. }
  34.  
  35. public void setPrezime(String prezime) {
  36. this.prezime = prezime;
  37. }
  38.  
  39. public int getIndeks() {
  40. return indeks;
  41. }
  42.  
  43. public void setIndeks(int indeks) {
  44. this.indeks = indeks;
  45. }
  46.  
  47. public boolean equals(Object obj) {
  48. if(obj == null) return false;
  49. if(obj == this) return true;
  50. Student st = (Student) obj;
  51. return (ime.equals(st.ime) && prezime.equals(st.prezime) && indeks==st.indeks);
  52. }
  53.  
  54. public String toString() {
  55. return ime + " " + prezime + "\t" + indeks;
  56. }
  57.  
  58.  
  59. }
Add Comment
Please, Sign In to add comment