I'm having issues with these two parts of my code.
I already declared a string ArrayList called "list", and I have another class called Magazine which adds magazines to the list. This class I'm having issues with is called MagazineList. I'm not very good with boolean methods...
Problem #1 (adding from another MagazineList to the list):
Code:public boolean addAll(MagazineList magazines) { if (list == magazines) { return false; } else { list.addAll(magazines); } return true; }
Problem #2 (adding to MagazineList from text file):
Code:public boolean addAll(String filename) { Scanner in = ResourceUtil.openFileScanner(filename); if (in == null) { System.out.println("Bad filename " + filename); return false; } String line = source.nextLine(); while (!line.equals("")) { list.add(Magazine(source)); } in.close(); }





Reply With Quote

Bookmarks