System.out.println("what is your name? ");
String name = kb.nextLine();
for(int i = 0; i < member2.size(); i++){
     System.out.println(name + " is a member. ");
  System.out.println(name +" is not a member. ");

i did a system.out.println on the member2 arraylist (String arraylist) and it prints out the correct stuff. when comparing whether or not name is equal to an item in the arraylist, it always give me the else statement even if the name is in the list.

for example, member2 contains:

and then i would type in "john", and it gives me "john is not a member."

It looks to me like your if statement is executed every time you compare, that way if the first string in the ArrayList is not the one you entered it returns ___ is not a member. Try using an intermediate variable like this:

boolean found = false;
for(String s : member2)
        found = true;
    System.out.println(name + " is a member. ");
  System.out.println(name +" is not a member. ");

thanks! it works!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.