Link to home
Start Free TrialLog in
Avatar of AntoniRyszard
AntoniRyszard

asked on

Changinf object values?

Hello,

Could anyone advise, I created an ArrayList of objects and now trying to loop through the objects and change the red value in each object.

Thanks

ArrayList array = new ArrayList();

Next I added the objects, and following code loops through the array.

for(int i = 0; i < array.size(); i++){
   RGB object = (RGB)array.get(i);
   double red = object.getRed() / 255.0;
   
   //Add red to array in the current object?          
}
Avatar of AntoniRyszard
AntoniRyszard

ASKER

There are both get and set methods:

double getReg(){
    return red;
}
 
void setRed(double red){
     this.red = red;
}
ASKER CERTIFIED SOLUTION
Avatar of InteractiveMind
InteractiveMind
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial