This tutorial helps you to switch between multiple installed Java versions on a Debian system. For example, you have installed multiple Java versions on your Debian Linux system. Now you want to switch to other Java version as default Java.
Use update-alternatives command to set default Java version as following command:
sudo update-alternatives --config java
According to the above screenshot, I have selection option 2 which will set Oracle Java 8 as default Java version on your system. You can use
java -version command to view default version.