Guest User

Untitled

a guest
Jan 23rd, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. import collection.StudentIterator;
  2. import collection.StudentList;
  3. import core.Student;
  4.  
  5.  
  6. public class TestStudentList
  7. {
  8.  
  9. public static void main(String[] args)
  10. {
  11.  
  12. System.out.println("--------Student class test--------");
  13.  
  14. Student a = new Student("Jakab Zsolt",20,"Informatika");
  15. Student b = new Student("Sipos Agnes",19,"Biologia");
  16. Student c = new Student("Takacs Szendi",15,"Matematika-Informatika");
  17. Student d = new Student("Szilagyi Andras",20,"Informatika");
  18.  
  19. System.out.println(a.getAge());
  20. System.out.println(b.getName());
  21. System.out.println(c.getFaculty());
  22.  
  23. System.out.println(a.toString());
  24. System.out.println(b.toString());
  25. System.out.println(c.toString());
  26. System.out.println(d.toString());
  27.  
  28. d.setAge(21);
  29. d.setName("Szilágyi András Márton");
  30. d.setFaculty("Szamitastechnika");
  31.  
  32. System.out.println("--------Student list test--------");
  33.  
  34. StudentList lista = new StudentList(4);
  35.  
  36. lista.addStudent(a);
  37. lista.addStudent(b);
  38. lista.addStudent(c);
  39. lista.addStudent(d);
  40.  
  41. StudentIterator iterator = lista.getIterator();
  42. while (iterator.hasMoreElements())
  43. {
  44. System.out.println(iterator.nextElement());
  45. }
  46. }
  47.  
  48. }
Add Comment
Please, Sign In to add comment