When installing a new Java version, the old one will not be overwritten. Only one of your Java installations will be active. It is easy to switch between versions.
To list the available versions, use the following command:
sudo update-alternatives --list java
This command will show a list of the installed Java versions. In order to switch, use this command:
sudo update-alternatives --config java
A simple selection menu will be shown which allows you to select the desired Java version.