Installed multiple Java JDK version on the same machine?

Is it possible to install multiple Java JDK version on the same machine using the jdk parameter and be able to switch the JDK using some exposed property or path?
For example, I want my test to run just once on a machine with JDK version 8 and 11 installed so that I can set my Maven compile goal to run with JDK 11 and have another goal (like test) to run with JDK 8. (The Maven stuff can be achieved with toolchain, etc.)