In Java, constants are declared as static final.
static final Complex CONSTANT = new Complex(1, 2);
If you want a lazy initialized constant, you want a stable value static final StableValue<Complex> STABLE_VALUE = StableValue.of();
Complex getLazyConstant() {
return STABLE_VALUE.orElseGet(() -> new Complex(1, 2))
}
If you want the fields of a constant to be constant too, Complex has to be declared has a record.