Check out example codes for "install java debian 8". It will help you in understanding the concepts better.

Code Example 1

echo deb http://archive.debian.org/debian jessie-backports main | sudo tee /etc/apt/sources.list.d/jessie-backports.list
echo 'Acquire::Check-Valid-Until "false";' | sudo tee -a /etc/apt/apt.conf
sudo apt update
sudo apt -t jessie-backports install openjdk-8-jre

Learn ReactJs, React Native from akashmittal.com