Matt Gerrans
Posts: 1153
Nickname: matt
Registered: Feb, 2002
|
|
Re: Unable to print found element in array
|
Posted: Apr 9, 2004 1:17 PM
|
|
Try trim down to just the part that is trying to find the element you seek and/or the part that is displaying that element and post just that (remember to use the java markup tags!).
By the way, that should be a simple method, not mixed in with your menu code. If it isn't maybe this is a good time to do that little refactoring exercise and probably while doing that, you'll discover the problem yourself as a side benefit.
Additionally, if you construct yourself a little unit test that tests finding an element, that will probably help make your code more modular and decoupled, while solving the problem. I'm not saying that you should go off and learn some unit testing framework right now, as you seem to be trying to finish your assignment for a nearby deadline, but you can write one test method and call it manually. Then later, when you have more time and less stress, you can learn a unit testing framework like Aritma SuiteRunner (http://www.artima.com/suiterunner/) or junit (http://www.junit.org/index.htm).
|
|