I have to use contains method on my program. If the user input "ar", all that contains "ar" of the list will be the output.

please help me..

What code do you have so far?
Look at the methods in the String class for checking if a String contains another String.

For testing the search algorithm, I'd hardcode in your program a value to search for and leave off getting the value from the user until later. Once you have the search working you can add the code to read the String from the user.

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.