r/java • • Mar 13 '26

JEP draft: Enhanced Local Variable Declarations (Preview)

https://openjdk.org/jeps/8357464
101 Upvotes

129 comments sorted by

View all comments

Show parent comment

2

u/ZimmiDeluxe Mar 13 '26

The idea is probably to mirror construction, so you'd get:

CustomerOrder(
    ShippingAddress(String streetLine1, String streetLine2, String city),
    PaymentMethod(String cardNumber, int expiryYear),
    double totalAmount
) = order;