wood burning stoves 2.0*
The moose likes Java in General and the fly likes Reading strings from a line problem _ any help!! 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 » Java in General
Bookmark "Reading strings from a line problem _ any help!!" Watch "Reading strings from a line problem _ any help!!" New topic

Reading strings from a line problem _ any help!!

celine scarlett
Ranch Hand

Joined: Nov 06, 2005
Posts: 93

My test main class allows user input to create one integer, which I've converted to a string, plus four strings representing details to be written to a file. When these details are written to the file they initially read correctly, eg:

111,hello one,hello two,hello three,hello four

The problem occurs when I try to write a second set if user entry values to this file. It is expecting four strings as words, and therefore reads and writes the above line as follows,


I have absolutely no idea why this is happening and would really appreciate some help or advice with this problem.

The current code for my test main class is as follows,

Any help or advice really appreciated at this stage!!
Peter Chase
Ranch Hand

Joined: Oct 30, 2001
Posts: 1970
It is rather difficult to give a good reply, because your code is based on the classes like TitleList, SimpleReader and SimpleWriter, which are not part of standard Java.

Guessing at what SimpleReader and SimpleWriter are trying to do, I cannot see anything immediately wrong with your code. However, something must be wrong if you are seeing wrong behaviour, so we would need to see exactly what these other classes do. That might be too much code to post, though.

Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
celine scarlett
Ranch Hand

Joined: Nov 06, 2005
Posts: 93

Thanks for the reply. SimpleReader and Writer allow basic reading in and out of files etc. My current code for the TitleList class is as follows,

The above class also uses the basic Title class which is as follows,

Can anybody see why this problem is occurring?

Any help gratefully appreciated!
I agree. Here's the link: http://aspose.com/file-tools
subject: Reading strings from a line problem _ any help!!
Similar Threads
How to return multiple strings of the same name from text file and array - any help
Calling an object from another class and printing out result - any help?
Problem saving data to text file correctly
Resolving conflict between constructor and method call in main class
Problem when reading a CSVs file as separate words - any help!!