Help needed to read/get information from a text file plz
I have a class actor which holds two instance variables: 'String name' and 'ArrayList<String> movie_titles'
To define these variables I will need to import the information from a file which has the following structure:
Attachment 2425
etc...
Any ideas on how I could do this anyone? Or any links as to where I can learn how to do this would be really helpful, thank you all so much
Re: Help needed to read/get information from a text file plz
First you will need to read the lines from the file into your program as Strings.
The Scanner class will help you do that.
Once you can read the lines from the file, you will need to "parse" the lines to extract the information you want to save. To do this "parsing" you will need to understand where the data is that you want to save. You will need some "rules" that define where in the lines the data is. For example some lines start in the first character of the line and some lines have leading spaces.
Re: Help needed to read/get information from a text file plz
Re: Help needed to read/get information from a text file plz
Thankyou both so much, I'll give it a shot at some point during tonight and let you know how it goes, fingers crossed. Thanks again