I'm trying to make a program in which an object is declared every time a loop is passed through.
package sequence;
public class SequenceServer {
SequenceObj sequence = new SequenceObj();
public void findSequence(int[] sequence, int lastNumber) {
for(int i = 0; i < sequence.length; i++) {
SequenceObj sequenceTemp = new SequenceObj(); // this line is wrong, but I don't know how to make it work
}
}
}
There are no errors, but I need to make it so a potentially infinite number of variables can be declared through the user interacting with the program, as opposed to me individually declaring all of the variables.