Hi Guys
Im new to programming and Java, but im willing to learn and trying hard using a book `Objects first with Java`.
Im trying to create a program for a Library where Members can join and loan books. But i keep getting an Error when using the Iterator.
My code is below:
import java.util.ArrayList; import java.util.Iterator; /** * Write a description of class Library here. * * @author (your name) * @version (a version number or a date) */ public class Library { private ArrayList<Book> books; private ArrayList<Member> members; private int nextMemberNumber; /** * Constructor for objects of class Library */ public Library() { books = new ArrayList<Book>(); members = new ArrayList<Member>(); nextMemberNumber = 1; } public void AddNewMember( Member newMember ) { members.add(newMember); nextMemberNumber++; } public int NumberOfMembers() { return members.size(); } public void ShowMembers( String getDetails ) { Iterator<Member> it = members.iterator(); while(it.hasNext()) { Member t = it.next(); System.out.println(t.getMember());// --------------------This is where the error is when i complie. getMmember? } } public int numberOfMembers() { return members.size(); } }
Any help would be great, i can see people really know what there talking about on here thats why i joined. Thanks Guys
Willo