sudo apt install default-jdk code example
Example 1: install java ubuntu
sudo apt install default-jdk
Example 2: install java ubuntu
sudo apt install default-jre
Example 3: how to install java on ubuntu 18.0.4
$ sudo apt install openjdk-11-jdk