I'm new to OO. I've just started programming in Java for my university course.
I have a problem: I have a method within the Club class to search for a member's name (or part of a name, according to my worksheet. I have a class that tests this without me having to manually create objects from the Club class (I'm using BlueJ).
Here's the search method:
public void searchMember(String name){
    i=0;
    found = false;
    while( i < members.size() && !found ){
        if(members.contains( name )){
            found = true;
        }else{
            i++;
        }
    }
    if(found == true){
        System.out.println(members.get(i));
    }else{
        System.out.println("Och Naw ... Member not found.");
    }
}
And here is the testing class code:
public void demo()
{
    club = new Club();
    club.join(new Membership("Gordy Broon", 1, 1972));
    club.join(new Membership("Eck Salmon", 9, 1965));
    club.join(new Membership("Davie Caramel", 5, 1960));
   System.out.println("Now doing some searching: ");
   club.searchMember( "mon" );
   System.out.println(" ");
   System.out.println("And some more searching: ");
   club.searchMember("moon");
   System.out.println(" ");
}
Can someone explain to me why when searching for "mon" the result is not found?
To my understanding this should work.
I am new so ANY help and explanation would be amazing ^_^ Thanks!
 
     
    