Newsletter sign-up
View all newsletters

Enterprise Java Newsletter
Stay up to date on the latest tutorials and Java community news posted on JavaWorld

JavaWorld Daily Brew

Help please:D



Hello everyone !
I am new here so I hope I haven't posted in the wrong place:D
I have this file , that I have to read from
It's structure is the following

T1. Poll topic
Q1. What …?
A1. Answer – p1%

Am. Answer – p1%

Qn. What …?
A1. Answer – pn%

Ar. Answer – pn%

(as you can see there are various numer of answers for each q and a various number of question for each poll , as there could be more than one poll in the input file)

How could I read the file in order to store only the information that is important to me like
for T - topic I only need the field with the name
for Q - question I only need the field with the question itself
for A - answer - the answer and the percentage
I tried to use a Scanner but it only works for the Q's & T's
If I read the file line by line how could I implement a reading that it is selective in order to know for each line if it is a T, a Q or an A?
Any thoughts will be higly apreciated!
Thanks!
And sorry if my English sucks!