public class B { private D d; private double value; public B(D d) { this.d = d; } public void updateValue(double lng) { this.value = lng; } public double getValue() { return this.value; } public void updateGPS(double lat2, double long2) { this.value = long2; this.d.updateLongitude(this.value); } }