I'm sorry, but your question is?
Is it producing any exceptions? Are there compiler messages? Or is it producing something you didn't expect, in which case, exactly how does the actual result differ from the expected result?
And, when you post code, use code tags.
masijade
Industrious Poster
4,253 posts since Feb 2006
Reputation Points: 1,471
Solved Threads: 494
StringTokenizer has nothing to do with this.
Also, look at your code and answer me these four questions.
- In the nameSearch method, what will be returned when the name is not found?
- In the main method (in your if statements), what will you print when the method returns that value?
- In the nameSearch method, what possible values will be returned when the name is found (e.g. 0 or higher)?
- In the main method (in your if statements), what will you print when the method returns one of those values?
Now, like I said, look at your code and answer those questions, don't simply answer them with what you intended.
masijade
Industrious Poster
4,253 posts since Feb 2006
Reputation Points: 1,471
Solved Threads: 494
you can use this code to make it more simple...
... unless
You want Java code
You want the brackets to match
You expect to use a loop variable somewhere within its loop
You want the test for "equal" Strings to work
You know that Strings and arrays are different things
You would like an answer within a year or two of when you post the problem
John: It's great that you want to contribute to this forum, but you will embarrass yourself less if you compile and test your code before posting it. Don't be put off, just be more careful.
J
JamesCherrill
Posting Genius
6,371 posts since Apr 2008
Reputation Points: 2,130
Solved Threads: 1,073