String names1 = "";


System.out.println("enter names: ");
		
names1 = kb.next();

		
while (names1 != "stop")
		
{
			
   System.out.println("enter names: ");
			
   names1 = kb.next();
			
   namesList.add(names1);
		
}

everytime i type "stop," the program keeps running...

it is better to use equals function instead of != , like this

while(!names1.equals("stop")

and also
can you print the value of names1 just to make sure ,

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.