Can i use java 13 language wit 'var' and compile to java 8 ?


I want to use the Java 10 or above with 'var' but i can use that to try to Compile to Java 8 ?


Hi Andro,

You can run older classfiles on a newer Java runtime, but running newer classfiles on an older runtime has never been an option. That hasn't changed with Java 10.

You can compile classes so that they run on older versions (using the --release option, for instance) - but only if you don't use newer features introduced since that version.

Local variable declaration (var) was introduced in Java 10, so if you want to use it in your classes, you need your JDK to be 10+.