ok so lets say I got class Bulb and class Picture. In bulb I got boolean variable if it is true the bulb is on if not the bulb is off I made it in the constructor that is off by default and made 2 method turnOn and turnOff. I need to make in picture arrays of Bulbs the user enter (in the main method when he creates the object picture) the length of the array . so lets say this is my picture class :
private Bulb [] arr ;
Picture(int len)
{
Bulb [] arr = new Bulb[len];
}
Now if I want to enter bulb on each cell I need to do this :
Bulb b = new Bulb();
Bulb c = new Bulb();
Bulb d = new Bulb();
for(int i=0;i<len;i++)
{
arr[i] = b;
arr[i] = c;
arr[i] = d;
}
Of course I can't do this in that way I don't now how many object to create its by the variable len .
arr[i].for(int i = 0; i < len; i++) { arr[i] = new Bulb(); }?