1.
Installation of JDK
Step 1: Download JDK from the site
Go to the Oracle site and open the Java SE download page. Under the latest
version of Java Platform, Standard Edition, click on the JDK download button.
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.
Step 2: Install the JDK exe file
To begin the installation, we need to double-click on the downloaded file, and
we will be presented with the below window.
Click on Next to proceed with the installation, and follow the Installation guide
provided for any queries.
Click on the Close button once the installation has finished.
To recover some of our system’s disk space, it is good practice to delete the
downloaded exe file once the download has been done.
Step 3: Check the directory
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.
For example: C:\> “C:\Program Files\Java\jdk-11.0\bin\javac” TestClass.java
So to set these variables, first right-click on My PC and select Properties.
Inside Properties, in the left-side panel, select Advanced System Settings, and
here choose the option Environment Variables.
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.
Step 5: Verify the Java Installation
Open the command prompt and enter the command “java –version”, and if it
runs successfully, Java has been successfully installed.
Now that we have seen the steps to install JDK, let the programming fun begin!
2. Installation of Eclipse
Step 1: Download the Latest version from the site
Download Eclipse Installer from http://www.eclipse.org/downloads
Eclipse is hosted on many mirrors around the world. Please select the one
closest to you and start to download the Installer
Step 2: Start the Eclipse Installer executable
For Windows users, after the Eclipse Installer executable has finished
downloading it should be available in your download directory.
Start the Eclipse Installer executable. You may get a security warning to run
this file.
If the Eclipse Foundation is the Publisher, you are good to select Run.
For Mac and Linux users, you will still need to unzip the download to create
the Installer. Start the Installer once it is available.
Step 3: Select the package to install
The new Eclipse Installer shows the packages available to Eclipse users.
You can search for the package you want to install or scroll through the list.
Select and click on the package you want to install.
Step 4: Select your installation folder
Specify the folder where you want Eclipse to be installed. The default folder
will be in your User directory.
Select the ‘Install’ button to begin the installation.
Step 5: Launch Eclipse
Once the installation is complete you can now launch Eclipse. The Eclipse
Installer has done it's work. Happy coding.
3. Program to check Student is Pass or Fail
4.
Step 1: Understand the Concept required for Program
First step is to know what are the program requirements
Which concept or logic can be used
To understand this program you must have idea about: if-else decision
making statement
Step 2: Make logic for program
First step is to enter the student’s marks
Make use of input function to get student’s marks from user
Condition for declaring a student as pass or fail is given below:
For, percentage >= 40 : Pass
For, percentage < 40 : Fail
Step 3: Write a flowchart diagram
Write a complete flowchart of the program as per logic
Step 2: Write the program Code
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!");
}
}