<story><title>Java 21: What’s New?</title><url>https://www.loicmathieu.fr/wordpress/en/informatique/java-21-quoi-de-neuf/</url></story><parent_chain><item><author>jph</author><text>The matching syntax looks really good to me:&lt;p&gt;&lt;pre&gt;&lt;code&gt;    &amp;#x2F;&amp;#x2F; Java 21
    if (obj instanceof Point(int x, int y)) {
        System.out.println(x+y);
    }

    &amp;#x2F;&amp;#x2F; Older Java
    if (obj instanceof Point p) {
        int x = p.x();
        int y = p.y();
        System.out.println(x+y);
    }&lt;/code&gt;&lt;/pre&gt;</text></item></parent_chain><comment><author>trealira</author><text>And that &amp;quot;older Java&amp;quot;  example itself is an alternative (added in Java 16, from looking it up) to what existed before.&lt;p&gt;&lt;pre&gt;&lt;code&gt;  if (obj instanceof Point) {
      Point p = (Point) obj;
      int x = p.x();
      int y = p.y();
      System.out.println(x + y);
  }&lt;/code&gt;&lt;/pre&gt;</text></comment>
<story><title>Java 21: What’s New?</title><url>https://www.loicmathieu.fr/wordpress/en/informatique/java-21-quoi-de-neuf/</url></story><parent_chain><item><author>jph</author><text>The matching syntax looks really good to me:&lt;p&gt;&lt;pre&gt;&lt;code&gt;    &amp;#x2F;&amp;#x2F; Java 21
    if (obj instanceof Point(int x, int y)) {
        System.out.println(x+y);
    }

    &amp;#x2F;&amp;#x2F; Older Java
    if (obj instanceof Point p) {
        int x = p.x();
        int y = p.y();
        System.out.println(x+y);
    }&lt;/code&gt;&lt;/pre&gt;</text></item></parent_chain><comment><author>riku_iki</author><text>Its not substantial improvement, but another invariant which need to be learned and adds more brain load.&lt;p&gt;I hope someone will design some jvm SimpleLang eventually, which will have very few syntactic constructions but cover all&amp;#x2F;most of use cases.</text></comment>