Installation of JDK: Step 1: Download JDK From The Site
Installation of JDK: Step 1: Download JDK From The Site
Installation of JDK: Step 1: Download JDK From The Site
Installation of JDK
Next, click on the Accept License Agreement button and choose your version of
Java for Windows (32-bit or 64-bit) to proceed with downloading the JDK
executable file.
JDK gets installed in the C directory of our system by default having the path
“C:\Program Files\Java\jdk-11.0”. If we make any change to this path at all, we
need to make a note of it as it will be required in the upcoming steps.
This is the directory structure for our example.
Step 4: Update the Environment Variables
The PATH variable in our system provides the exact location of executables
that will be used for running Java programs, such as javac and java. The
CLASSPATH variable provides us with the library files location.
If we do not set the PATH variable, we will specify the full path to the JDK bin
every time we run a program.
Click on New, and type PATH in the Variable Name, and enter the path of the
bin of installed JDK in the Variable Value field.
If we already have the PATH variable, we can edit it by adding it to the existing
values.
Click on the OK button to apply the changes.
import java.util.Scanner;
public class PassFail
{
public static void main(String[] args)
{
int num;
Scanner reader = new Scanner(System.in);
System.out.println("Enter score: ");
num = reader.nextInt();
if (num>=50)
{
System.out.println("Pass!");
}
else
System.out.println("Fail!");
}
}