I have struggled many times to switch between different JDK versions quickly. There always seemed to be many steps required to be done.
Ever since I started using openjdk, and then focussing on doing my machine setup via a script (as opposed to doing each step manually), I came across this very simple way of switching the jdk.
https://github.com/AdoptOpenJDK/homebrew-openjdk#switch-between-different-jdk-versions