Hi @Anvi, to install Java on Ubuntu, you just have to type-in some commands on your terminal and it will install the JDK and JRE whatever you wish to install. Please follow the steps to install Java:
1. To install the default JDK, firstly update the package repository:
>>sudo apt-get update
>>sudo apt-get install default-jdk
2. Now if you want to install the default JRE, use following command:
>>sudo apt-get install default-jre
3. To check the installed version, user following command:
>>javac -version