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 text data files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "text data files" Watch "text data files" New topic
Author

text data files

Nazma Panjwani
Greenhorn

Joined: Jan 17, 2010
Posts: 17
Guys,
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.

Thanks.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41073
    
  43
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.


Ping & DNS - my free Android networking tools app
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.
 
Don't get me started about those stupid light bulbs.
 
subject: text data files
 
Similar Threads
unable to exit program..
Need a little help...
No such element error
Using String Tokenizer...
Confused with file read