This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes text data files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "text data files" Watch "text data files" New topic

text data files

Nazma Panjwani

Joined: Jan 17, 2010
Posts: 17
Please tell me what I am doing wrong,
I created an input file, called inventory.dat, saved in under the same package, as the following class, please see the code blelow,
basically, the programs reads an input from the file, makes objects, saves them in an array, and prints them; the input file just has
item, units and price llisted on each line. I dont have any syntax errors, the programs runs properly, but there is not output produced. Is it
not reading from the file??? It is not even throwing any exceptions.

Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
You may want to print out each "line" to see what progress is being made.

In the future, please UseCodeTags when posting code of any length. It's unnecessarily hard to read the code as it is, making it less likely that people will bother to do so.
Shashank Agarwal
Ranch Hand

Joined: May 20, 2004
Posts: 105
I guess the problem is in line 44 inventoryItem[scan], although you might first want to ensure that all lines are read properly, as suggested by the other poster.
I agree. Here's the link:
subject: text data files
It's not a secret anymore!