(var scope = StructuredTaskScope.open()) { Subtask<String> name = scope.fork(() -> readName()); Subtask<Address> address = scope.fork(() -> readAddress()); scope.join(); System.out.printf("%s's home is %s %d, %s%n", name.get(), address.get().street(), address.get().house(), address.get().city()); } catch (InterruptedException e) { throw new RuntimeException(e); } }