How to fix java.lang.UnsupportedClassVersionError: test (class file version 52.65535) was compiled with preview features that are unsupported?

In launch.json file, add "vmArgs": "--enable-preview" to your debug configuration.

{
   ...
   "vmArgs": "--enable-preview"
}