Basically, you can follow these commands to install JDK 10 on your Ubuntu Machine:
sudo add-apt-repository ppa:linuxuprising/java
sudo apt-get update
sudo apt-get install oracle-java10-installer
Once done, you can set this as a default by using this command:
sudo apt-get install oracle-java10-set-default
After that, you can verify this, by using this command:
$ java -version
java version "10.0.1" 2018-04-17
Java(TM) SE Runtime Environment 18.3 (build 10.0.1+10)
Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.1+10, mixed mode)
I hope this will help.
Want to become a Java Expert? Join Java Course now!!
Want to know more about Java? Watch this video on Java Tutorial for Beginners | Java Programming: