reading in file and storing in array
I have to read in a file like this:
something that one wishes to convey, especially by language
a word whose definition is in a glossary
a string of characters in a language, which has at least one character
a sequence of words that gives meaning to a term
a list of difficult or specialized terms, with their definitions,
usually near the end of a book
a set of strings of characters, each of which has meaning
a printed or written literary work
I need to store the terms and definitions in separate arrays. However in the same order respectively so they still align. Is there a good way to do this?
Re: reading in file and storing in array
Well the best way would be to create objects and store them in a Collection but I guess that is beyond your learning at this stage. What you need to do is read a line of text, store in term array, read a line of text, store in definitions array, repeat until reach end of file. If there are actually blank lines then you will need to handle them as well.