Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import javafx.beans.binding.DoubleBinding;
import javafx.beans.property.DoubleProperty;
import javafx.beans.property.SimpleDoubleProperty;

public class Main {
    public static void main(String[] args) {
        final DoubleProperty radius = new SimpleDoubleProperty(2);

        DoubleBinding volumeOfSphere = new DoubleBinding() {
            {
                super.bind(radius);
            }

            @Override
            protected double computeValue() {
                return radius.get() + 4;
            }
        };

        System.out.println(radius.get());
        System.out.println(volumeOfSphere.get());

        radius.set(50);
        System.out.println(radius.get());
        System.out.println(volumeOfSphere.get());
    }
}