Now, Im currently wrinting a simple graphics program. In it I hava a Array called m_ball.
Now, m_ball is suposed to contain up to 20 instances of the class Ball.
Rigth now I do this by the following code =
Ball m_activeBall0 = new Ball();
Ball m_activeBall1 = new Ball();
Ball m_activeBall2 = new Ball();
ect...
m_ball[1] = m_activeBall0;
m_ball[2] = m_activeBall1;
m_ball[3] = m_activeBall2;
ect...
Now thats all sound and well. But aint it posible to do it in a for loop. some thing like this =
for(int i = 0; i <m_ball.length;i++) {
Ball m_activeBall[i] = new Ball();
m_ball[i] = m_activeBall[i];
}
or have I lost it?
I simply cant seem to find a way to do this.
I tried Google, but cant seem to find the answer.
Oh.. yea. forgot to add. its Java.