I want that an user to introduce a string in a console and that string have to check if it exist in an array. If they match it print a message that it match else a message that don’t match.
But my code, it is not running properly. Please tell me, what is wrong with it ?
I think I can see what the problem is. The fact that your code style and indentation are quite good made it easier to find
Go through your loop carefully. Let's imagine your array looks like this:-Imagine you are going through the array looking for "is" and then try looking for "Campbell". See what happens for each iteration of the loop. A pencil and paper will help.
Why are you using Strings to represent numbers? Can use an int instead? If you declare and initialise an array on the same line, (line 5), you are allowed to omit new String.
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop