Hi guys, in this home automation application, I want to create an instance of DVDInfo for each line of data I read in from the dvdInfo.txt file. For each instance, I will parse the line of data and populate DVDInfo's three instance variables. Finally, I want to put all of the DVDInfo instances into an ArrayList.
Hi Shamsudeen, I have edited the post and reformatted the code for you, so that its more clearer for the person reading it.
Coming back to your query: you are creating a new ArrayList instance but your populateList method is not aware of this instance because the scope of the reference variable you are using is limited to the main() method. You can pass around the reference to the populateList method and let the method take care of adding the DVDInfo to the list. So it would be something like:
PS: the code I have given above is syntactically not correct, its just an idea of how you can fix your code.