What Java version is used for Minecraft 1.18

If you are playing Minecraft 1.18 - Java Edition (released on 30 November 2021) and wondering which Java version it is based on? It's Java 17.

Java version 17 was released in the last year on 14 September 2021.

Minecraft now uses Java version 17. If you are using a default setup, the Launcher will download and install the correct version. If you are using a custom Java setup, or a third-party launcher, you will need to ensure that your Java installation is version 17 or above.

Source: https://feedback.minecraft.net/hc/en-us/articles/4415128577293-Minecraft-Java-Edition-1-18