Skip to main content

What is Java

Java is a general purpose programming language. Which means this programming language is used in many purposes apart from being used only in android application development.

There are a few similarities between Java programming language and C++ programming language. But Java programming language is having some advanced features which you are going to learn in future.

In programming languages you write programs in the form of statements in many lines and those statements are executed one by one.

In Java, the execution happens really fast and concurrently it can execute many statements.

Java is a platform independent (Java compiled byte code can be run across different operating systems) and object oriented programming language.

 

Why should we learn Java programming language?

 

Easy to learn:

Java is a easy to learn programming language. Once you start learning Java programming, you will actually be learning the real programming and you will observe everything very closely.

When you learn Java you will know how programming works and how the computer executes a function or a code. All these coding concepts will be cleared very easily and you can be a good programmer quickly through the learning process of Java language.

Commonly used Language:

Java is a commonly used programming language.  This programming language is found to be used in so many applications and devices.

Java programming has been used to build android operating system, mobile applications, etc.

Apart from mobile technology, there are so many other devices such as satellite, television, communication devices where Java programming language has been used.

 

Large community:

Since Java programming language is a commonly used programming language, so it has a very large community.

There are more than 10 million people using Java programming language.

So this basically means Java programming language is very popular and there are going to be huge need for skilled Java programmers in the upcoming years.

So, you should undoubtedly start learning Java and set your future goals.

Also, since this programming language has a strong community base, so whenever you face any problem during the learning process of this language or you get stuck somewhere, you always expect to get a solutions from other community members.

 

IDE helps programming easy:

Since you are going to be learning Java through IDE such as Android studio or Eclipse IDE, your entire coding experience will be very smooth and enjoyable.

These IDEs are having complete solution for writing codes, compilation, debugging, checking your workflow and many more.

So in short these IDEs are really helpful in learning and practicing Java language.

Most of these IDEs are open source which means you can download them from the internet at free of cost and use conveniently.


How does Java work?

Whatever codes we write in the java programming, those codes are saved in a .java extension file. This .java extension file is called the source file.

Basically source file is a file which contains the source code of Java program.

After you save the source code, you need to compile the source code with the help of a Java compiler.

Now compilation means converting the human understandable program codes into the machine language which generally contains 0 and 1. 


Once the compilation process is over, we get another file with the extension of .class which contains machine understandable language. These codes are called byte codes.

After compilation we can run this code in different platforms such as Windows, Mac or Linux.

 

Write your first code in Java

Let’s see how to run a simple “hello world” java code.

Initially this code might appear to you as complicated and difficult, but for now we are just trying to show how a java program runs.

Once you see this, you will understand how a program is executed. 

We will explain everything in detail later.

In order to run our first program in Java, we have to write the below source code and save the file in .java extension.

 

Source Code:

Public class MyFirstClass{

Public static void main(String[]

args) {

System.out.printIn(“Hello World”);

}

}

Now save the file in the same name as given the class name with .java extension. If you save the file in a different name, then the program will not run or you might see an error.

Now open the terminal and find the saved file.

Proceed to compile the saved file by just putting the right command prompt which is javac and then write the filename.

As soon as you hit tab button, your file will get compiled and a .class extension file format will generate which will contain the byte codes. This .class file was not present before the compilation process.

Now you need to run this .class extension file name by just writing java followed by the filename in the command prompt and finally you will be able to see the “hello world” message which was saved in the .java file.

Hey, congratulations! You have successfully written and compiled your first java program.

I know you must be having a lot of quest about the syntax and the codes that you have written to execute the program.

Trust me guys, you have taken your first step to the programming world and you will just rock it after a few months when you will just complete the entire Java tutorial.

You will get answers to each and every question of yours in our website.

We are going to be discussing in detail about the syntax and also we are going to be answering what all those codes do mean in advanced lessons.


Also Read:

Comments

Popular posts from this blog

Java User Input Exercise

Exercise 1: Write a simple java program to take user input of a number and store it inside an integer variable. Later print the number on the screen.   Solution 1:   import java.util.Scanner;   public class UserInpur {        public static void main(String[] args ) {               Scanner sc = new Scanner(System. in );           System. out .println( "Enter a number" );           int x = sc .nextInt();           System. out .println( "You have entered:" );                   System. out .println( x );        }   }   Exercise 2: Write a simple java program to tak...

Java Operators

In this lesson you are goin g to learn about operators in Java and also what are the different types of operators used in Java programming.   In our previous lesson we have learnt how to take user input in Java. We were performing different types of arithmetic operations in order to create a simple ration shop billing application which took different values as the user input and calculated total billing amount.   During the programming the billing application we used different signs like addition (+) , multiplication (*) etc. These signs are called operators in Java programming.   Types of Operators in Java There are five types of operators in Java. Arithmetic Operators Bitwise Operators Assignment Operators Comparison Operators Logical Operators 1.Java Arithmetic Operators Arithmetic operators are used to perform mathematical operations such addition, division, multiplication, subtraction and modulation. Let’s see the example of arithmetic operators in below:   ...