fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Box
  9. {
  10. public LinkedList<NoteCard> data;
  11.  
  12. public Box() {
  13. this.data = new LinkedList<NoteCard>();
  14. }
  15.  
  16. public Box addCard(NoteCard a) {
  17. Box one = this;
  18. one.data.add(a);
  19. return one;
  20. }
  21.  
  22. public static void listBox(Box a, int index){
  23. ListIterator itr = a.data.listIterator();
  24.  
  25. while (itr.hasNext()) {
  26. System.out.println(itr.next());
  27. }
  28. }
  29.  
  30. public static void main(String[] args) {
  31. NoteCard test = new NoteCard("Ryan", "Hardin");
  32. Box box1 = new Box();
  33. box1.addCard(test);
  34.  
  35. listBox(box1,0);
  36.  
  37. }
  38.  
  39. static class NoteCard {
  40. public NoteCard(String a, String b) {
  41. }
  42. }
  43. }
Success #stdin #stdout 0.1s 320576KB
stdin
Standard input is empty
stdout
Box$NoteCard@52e922