Java For Beginners-Chapter-1 Introduction and Setting Up the Coding Environment

POSTED BY Mohd ShibliCATEGORY Java

Tweet In this series we will learn Java from scratch and will try to cover every possible aspect of Java, In this chapter we will give you a short intro about java and then we will setup our coding environment for writing Java Codes and in the end of the chapter we will write a simple «hello world !» program in Java, So let’s get started.

Why choose Java?

Java is an object oriented programming language and was originally developed by Sun MicroSystems.

1- Java is an Object Oriented programming language.2-Java is easy to learn since it is a high level language — If you know OOP then you know Java.3-Java is secure It allows us to make vulnerability free systems.4-Java is Robust.5-Java is dynamic- Java is considered to be more dynamic than C/C++
Setting up our environment
This section of this chapter will guide you how to set up your Java development Environment on your PC.

1-Download Java SE from the given link download, download the version according to your operating system.When downloaded install the package on your PC.
Configuring path in windows 10 OS
For example you installed java in the following directory «c:\Program files\java\jdk«
1-Right click on «This PC» and select properties

2-Select «Advanced system Settings» on the left hand side of the screen.

3- Under «Advanced» tab select «Environment Variables».

4-Now edit the path option as shown below and Add the following path into it «c:\Program Files\Java\jdk1.8.0_91\bin» the version will change according to your downloaded version here i am using jdk1.8.0_91

Now we have successfully configured the path now it’s time to test our java.Before doing anything restart your PC.After restarting Press Windows+R>>type «cmd» or type cmd in the search box which will open command prompt.


In command prompt type

java -version 

This command will show the current version of Java you are using if you have done all the above steps correctly.After this type

javac -version 

This command will tell you the current version of java compiler you are using.
Writing our first java program
Now let us make a simple hello world program in java and test it on our newly installed java compiler.write the below code as it is in a text editor and save the file with name «javaprogram.java» in the following directory «c:\users\your_pc_name».

public class javaprogram {    public static void main(String []args) {      System.out.println("Hello World"); // prints Hello World   } } 

Note: the program you write should match exactly as above written code
Now to run the above program open command prompt and type the following commands into itTo compile the program type the following command

javac javaprogram.java 

To run the program type the following command

java javaprogram 

If everything goes well the console will print «hello world» as output.
So now you have successfully setup java on your PC, this is it for now in the next chapter we will dissect the above helloworld program and will learn what each line of code means.
Thank you for readingIf you like this tutorial then please share it and help us grow, you can comment your queries in the comment section down below and do not forget to subscriber us ;-).

Понравилась статья? Поделиться с друзьями:
Добавить комментарий