News for hackers. Stuff that matters.
Re:Java 21: What’s New? by morepork on Wednesday August 09, 2023 @07:16PM (#37069694)
It's a bit of an unkind example as most would write the latter as

    if (obj instanceof Point p) {
        System.out.println(p.x()+p.y());
    }
But I can maybe see the value if you need to use x/y more than once.

However in Java it's common to have getX() style accessors, for which this syntax doesn't seem that helpful as your variable would end up being called getX

Re:Java 21: What’s New? by valenterry on Thursday August 10, 2023 @02:52AM (#37072826)
I think this syntax for accessing x and y only works for java records anyways and not for methods.