How can I insert the data of an ArrayListString into a java constructor?

0

I've been trying for many hours, I'm trying through files, when I read the data, I insert the data to a 4-parameter constructor, what I want to achieve is that when I read those 4 parameters, I created another new Magazine (that's what the construtor's class is called), but always and only the first one does it. I hope your help. Thanks in advance. The Publication class is an abstract class of Polymorphism. and the Magazine class extends of Publication.

    
asked by Samuel Tena 20.01.2018 в 04:42
source

2 answers

0

If I understand your question correctly, you need to iterate the list, for which a simple

for(TipoDeDato dato : tuLista) { //cualquier operacion con dato };

In your case the data type is String.

    
answered by 20.01.2018 в 05:19
0

You have to create as many objects as there are words in your arraylist , that is, if you have 24 words in the array and your constructor supports 4 parameters are 24/4 = 6 6 objects , every time you create an object, save it in the publications object and at the end you will have it

    
answered by 14.11.2018 в 21:12