This tutorial helps you to switch between multiple installed Java versions on Ubuntu systems. For example, you have installed multiple Java versions on your Ubuntu system. Now you want to switch to other Java version as default Java.
Use update-alternatives command to set default Java version as following:
sudo update-alternatives --config java
According to the above screenshot, Java 10 is now set as default Java version on your system. You can use
java -version command to view default version.