Var key word in java not working

I recommend using “openjdk-16 Oracle OpenJDK version 21” and set the “Language Level” to the SDK DEFAULT. The system will automatically adjust the language level to match your JDK. See SCREEN CAPTURE # 1.

That said, you can always download JDKs. What they do is enable new language features or tweak syntax. So use the one you are more comfortable with (probably 17). See SCREEN CAPTURE #2.

Also, consider this: