File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Need Help with Indexes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Need Help with Indexes" Watch "Need Help with Indexes" New topic
Author

Need Help with Indexes

Jim Wysocki
Greenhorn

Joined: Oct 30, 2002
Posts: 1
I'm trying to assign values to corresponding Indexes. I'm using the find method but all of the printouts show the last entered item for each index. The math is correct but there's a bug in the code i can't figure out.


Marilyn added code tags
[ October 30, 2002: Message edited by: Marilyn de Queiroz ]
William Barnes
Ranch Hand

Joined: Mar 16, 2001
Posts: 984

Could you please write a smaller program which shows the problem, or point out where in this piece of code you are seeing the problem. And give a specific example. Like:
items[1] contains the value "tree", instead of "tower".


Please ignore post, I have no idea what I am talking about.
Amy Snow
Greenhorn

Joined: Oct 31, 2002
Posts: 2
Hi! I am doing the same project in my ISYS 216 class at FSU. I'm in the 9:00 class. The only thing I noticed with your program is that u need braces for the if statements in the find() method and both of the store() methods.
Dave Vick
Ranch Hand

Joined: May 10, 2001
Posts: 3244
Amy is correct, although in the find method it is less important because you only have one line after the if statement. In both of the other two methods you'll only execute the first line after the if statement if it is true, the other two following lines will always be executed.
Putting the braces around the if statement (Even if it is only one line) is not a bad idea to get into. If you really hate them on one liners then put the line to be executed on the same line as the if statement itself.


Dave
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Need Help with Indexes
 
Similar Threads
Help with an array situation
DUE AT MIDNIGHT TONIGHT..1 ERROR..HELP
I cannot fix this program! if anyone can help!
Printing out of an data stored in and array and SringBuffer array
orphaned case error on compile