I am trying to make an array of objects. I have Two classes, the main and another class for the methods. The one i am running the program in is TestTrivia, the class with all the methods for TestTrivia is Question. Constructor for this class is public Question() { question = "null"; answer = "null"; pointValue = 0; } i am trying to do something like this Person personArray[] = new Person[5];
for(int i=0; i< personArray.length; i++)
{
personArray[i] = new Person();
}
So i have tried Question QuestionArray[] = new Question[5]; for(int i=0; i< QuestionArray.length; i++) { QuestionArray[i] = new Question(); } I have tried to use it in both classes, the main and the one full of methods. It should go into the main class correct? The error i am getting is the whole for statement is underlined and says: illegal start type cannot find symbol symbol: class i location: class triviagame.TriviaGame package QuestionArray does not exist triviagame is the package name, "TriviaGame" is the class name, "Question" is another class name.
Question[] questionArrayin Java (although I'd call itquestions). Please show the exact code you're trying, not just a fragment.class i? There's absolutely nothing wrong with the fragment in isolation except for the misleading variable name.QuestionArray, noti.