Hey guys, got a problem with a question.
Question : Write a declaration for a variable people that could be used to refer to an Array of objects of type Person
My answer:
public people[];
people = new Person [100];
But I am getting an error saying it is wrong. What am I doing wrong?
PS. I also tried public people[] = new Person [100]
The error that I am receiving is this:
Main.java:5: <identifier> expected
public people[];
^
Main.java:6: <identifier> expected
people = new Person [100];
^
2 errors
The output should have been: If it wasn't correct it won't have compiled
This is what was actually produced: Exception in thread "main" java.lang.NoClassDefFoundError: Main`