int numbValues; // not initialised, will be zero
int[] values = new int[numbValues]; // array of zero elements, any index will be out of bounds
Object(int numbValues) {
this.numbValues = numbValues; // updates numValues, but too late to affect size of array
}
.
JamesCherrill
... trying to help
8,519 posts since Apr 2008
Reputation Points: 2,583
Solved Threads: 1,455
Skill Endorsements: 30
Question Answered as of 7 Months Ago by
JamesCherrill
and
richieking