Step 0: Download the latest Java Development Kit ( JDK ) on your PC by the below link
Step 1: Run the downloaded .exe file.
After the setup is completed, JDK will be installed at the default location.
C:\Program Files\Java\jdk1.8.0_301
(you may also change the location of the installation )

Step 2: After the installation of JDK on your desktop, you need to set the path in environment variables, For that
1 - Right-click on My Computer or This PC and go to Properties.

2 - Now click on Advanced system properties, after that a dialogue box will appear on the screen.
3 - Now navigate to the bin folder and copy the path of the bin folder inside the installed JDK folder
i.e- C:\Program Files\Java\jdk1.8.0_301\bin
4 - Now Click on Environment Variables then Go to the system variables click on PATH paste the path of the bin folder inside it and click OK.
If there is no such named row in the Environment variable then, you have to create a new row named PATH as a variable name.
Inside the variable value, you have to paste the path of the bin folder and click OK.
5 - Now you can check the version of your JDK by the following command on the command prompt
javac-version
Hence you successfully installed Java on your Desktop, Now you are good to go for your first Java program.
Two Minute Drill
- Install JDK: Download and install the latest JDK.
- Set JAVA_HOME: Enter JAVA_HOME to update the configuration path.
- Select IDE: Install and configure the IDE (e.g., IntelliJ, Eclipse).
- Test Setup: A "Hello, World!" Program to ensure that the system works.