What is 'project bytecode version' in 'Intellij - Java Compiler option'?

Viewed 14

I can select JDK version on Project Structure - SDK, and it means my java code will be compiled with JDK that I selected.
If I select JDK 1.8, my code will compiled with JDK 1.8.

In this situation, I can't understand Setting - Build, Execution, Deployment - Java compiler - project bytecode version option.
What happens if I select a version of this option that is different from the Project Structure - SDK?

1 Answers

The bytecode version means the verion of your generated class file.

Generally, the jdk N can generated or load any class files whose version less or equal then N. For example JDK 11 can compile the source files to class files with bytecode version 11 or 10 or 9 or 8, and at runtime, it can load the class files whose version less or equals 11. but it can not load the class file with version 12.

Related