So for my current program, I am currently doing this:
Java Code
ArrayList<Section> aMainSection = new ArrayList<Section>();
Section aSection = new Section();
aSection.setName("Document 1");
aSection.setSection("Section 1");
aSection.setText("Text 1");
Section aSection2 = new Section();
aSection2.setName("Document 2");
aSection2.setSection("Section 2");
aSection2.setText("Text 2");
Section aSection3 = new Section();
aSection3.setName("Document 3");
aSection3.setSection("Section 3");
aSection3.setText("Text 3");
But what I want to be able to do is create a for loop in which when the condition is met, I can just create a new Section. However, I do not know how to increment variables in Java. I would assume it should be possible, somehow, but I know it's not as simple as concatenating an integer value to the end of the variable name. Any help would be appreciated, thank you.
List<Section>, and add to the list. What's wrong with doing that?