This tutorial describes how to install various versions of OpenJDK as well as Oracle Java on Ubuntu 18.04. The same instructions apply for Ubuntu 16.04 and any Ubuntu-based distribution, including Kubuntu, Linux Mint and Elementary OS.

https://linuxize.com/post/install-java-on-ubuntu-18-04/