Hello all.
I have started learning java and i need some help on an issue i am having. I am trying to create a program that writes 4 variables to a file (separated by commas ",") and then prints out the file line by line in a formatted manner
I actually have it workign using string.tokenizer, however i know this is depricated and am trying to get it working using string.split(",") or .useDelimiter(",")
the problem i am having is that my code seems to go past the end of line character picking up the first variable of the next line and adding it to the last variable of the previous line. the loop is only running twice and then erroring out.
It is also printing the “.” At the beginning of the first value of the next line instead of the end of each line.
I have tried several variations and i have no idea as to why it is doing this. any help at all would be appreciated. Below is the code i am using
the file is a csv file and the contents are in the format :
P3847,Condensed Powdered Water,2.5,per packet
K3876,Distilled Moonbeams,3.0,a dozen
Z9983,Anti-Gravity Pills,12.75,for 60
Q9887,Powdered Fairy Dust,20.5,per pack
the output i am getting is here :
http://snag.gy/9mBqI.jpg