If you are planning to install NetBeans then install openjdk-8-jdk because openjdk-9-jdk is not compatible with NetBeans from the default Ubuntu repositories, at least it is not compatible with NetBeans in Ubuntu 16.04. The version of NetBeans in 16.04 is NetBeans 8 which targets Java 8 as its compatible Java version. NetBeans from the default Ubuntu 18.04 and later repositories, is compatible with openjdk-11-jdk.
Another alternative is to install both openjdk-8-jdk and openjdk-9-jdk and use either update-alternatives --config java
(update-alternatives is provided by default by dpkg in Ubuntu) or update-java-alternatives
(which is installed when openjdk-8-jdk is installed) to manually choose which Java to use before running an application. See update-java-alternatives vs update-alternatives --config java.