vendredi 27 février 2015

Dynamically update a member based on other member in class



This is my class



public class Cars{

public double Len;
public List<Double> vehicle;


setters and getters



public List<Double> getVehicle() {
return vehicle;
}
public void setVehicle(List<Double> vehicle) {
this.vehicle= vehicle;
this.Len = this.vehicle.size();

}

public double getLen() {
return Len;
}

public void setLen(double Len) {
this.Len = Len;
}


}


Is it possible to update the member Len with length of position List of vehicles .




Aucun commentaire:

Enregistrer un commentaire