Check out example codes for "instalar java ubuntu 18.04". It will help you in understanding the concepts better.

Code Example 1

sudo apt install default-jre

Code Example 2

OutputCommand 'java' not found, but can be installed with:

apt install default-jre            
apt install openjdk-11-jre-headless
apt install openjdk-8-jre-headless

Learn ReactJs, React Native from akashmittal.com