Issue
Essentially I have classes such as Main & Page. Is there anyways to automatically create a new Page type based on how many pages the program detects that I'll need (based on how many of the key phrases it is able to parse)
EX: Say the key phrase showed up 4 times. I'd want a new Page object for each page automatically titled Page + #.
Solution
The best way to do this would be an Array of the Page Class.
public Page foo[];
...
public void createPages(int pages){
foo = new Page[pages]; //makes pages # of Pages in the array
foo[index] = new Page(fee, faa, foe);
}
This would allow you to access each one by using foo[index]...
the new Page(fee, faa, foe) allows for a constructor with the array.
Answered By - Sploder12
Answer Checked By - Marilyn (JavaFixing Volunteer)