Java – Introduction

Introduction to Programming Language:

Let us learn programming in this java tutorial series.

What is programming ?

Computer programming is the process of designing and writing an executable computer program, provides solution for various computer tasks.

Its also termed as the computer program which is laid as set of instruction for performing specific tasks, provides the result as output.

What is programming languages ?

A Programming language is the set of guided rules or instructions executed on a computer or a computer device to perform specific tasks.

There are various programming languages like Java,C,C++,Python etc

What is Java ?

Java is a programming language, was created by James Gosling for Sun MicroSystem and later it is own by Oracle Corporation.

What is Java Programming ?

1. Java is a high-level programming language which is in human readable form.

2. Java is the programming language like C and C++ but varies from Syntax which can be easily understandable and editable.

3. Java is an Object Oriented Programming Language, which uses the Object Oriented programming concepts like Abstraction,Encapsulation,Inheritance and Polymorphism very effectively.

4. Java is mainly used to create Web-applications, mobile applications and platforms.

Why we need a Java Programming language ? 

there are many programming languages like C and C++ but

Why java become more famous? and why we need java ? 

The main reason is its purely platform-independent, which means it can run in any platform.
Java programming languages is used in various applications listed below.

  •  Desktop Applications
  •  Web Applications
  •  Enterprise Applications
  •  Mobile Applications
  •  Smart Cards
  •  Embedded Systems
  •  Scientific Applications
  •  Computer Games Etc…

Some devices and applications are mainly running in Java , a few listed below

  • Application Softwares
  • Internet Of Things
  • Airplane Systems
  • ATMs
  • BlackBerry Smartphones
  • Blu-ray Disc Players
  • Cable Boxes
  • Cell Phones
  • Computers
  • Credit Cards
  • CT Scanners
  • Home Security Systems
  • Parking Meters
  • PlayStation Consoles
  • Printers
  • Public Transportation Passes
  • Robots
  • Routers
  • TVs
  • Diagnostic Systems
  • VoIP Phones ..etc 

In statistics is known that Java is running in over 3 billion devices.

Here we get the point that all the devices will not run the same platform, obviously different devices runs in different platforms which we don’t know exactly.

But Java runs in all the devices means, Java is capable of running in different platforms to meet the device requirements and its successful.

So Java programming language is a platform-independent.

What is operating system ?

Its a computer program which controls and manages all the hardware and software resources provides all the services for executing all other application programs.

Types of operating system,  major OS is listed below.

  • Windows Operating system
  • Unix/Linux Operating system
  • Mac Operating System 

What is Platform ?

Platform is a combined thing of computer hardware and software (Operating System) on which software applications can be run.

So Java Program runs in different platform , the question is

What is platform ? how java program runs in different platforms ?

First we have to differentiate the programming language runs in same platform and in different platforms.

C and C++ and platform dependent languages which runs in same platform , where as Java is a platform independent programming language which runs in all platforms.

Why C and C++ are platform dependent programming language ?

In C and C++ programs the compiler which compiles the human readable code and converts it in to Machine language (0s and 1s) and like the same way in reverse process the compiler also converts the CPU output Machine language (0s and 1s) in to human readable output in the screen. 

And this C/C++ compiler is Operating System dependent.

Input process :  C Program –> C Compiler —> Converted to Machine Language —> Executed in Windows Operating System.

Input process :  C Program –> C Compiler —> Converted to Machine Language —> Executed in Linux Operating System.

Input process :  C Program –> C Compiler —> Converted to Machine Language —> Executed in Mac Operating System.

Output process : Output from Windows processor —> in Machine language —> again converted to Human readable output.

Output process : Output from Linux processor —> in Machine language —> again converted to Human readable output.

Output process : Output from Mac processor —> in Machine language —> again converted to Human readable output.

Example : if we create a C/C++ program and compiled in Windows operating system and after the program executed successfully, if we copy the same code to a another machine which have Linux Operating System installed.

And if we run the same code again over Linux Operating system, it will not execute.

Because the Compiler installed in Windows environment is works different compared with the Compiler installed in Linux environment, already compiled code will not work in different environments ( platform-dependent ).

Hence for every time we have to recompile the code again in different platforms and then execute the code. 
So C/C++ language is platform-dependent programming language.

Why Java is platform independent programming language ?

In Java its totally different compilation process handled inside, 

1. Java program is created and it should always be saved with the extension (.java) format, eg : 

2. Java code is compiled using Java Compiler.

3. Java code which is also called as human readable source code when compiled with Java compiler converts the source code in to byte-codes, thereby the compiler creates a .class file

4 .These .class file is then executed by JVM – Java Virtual Machine with the help of JRE – Java Runtime Environment executes the .class file and converts it to Machine language (0s and 1s).

5. JRE provides the libraries, which the Java Virtual Machine and other components to run the program in the Java.

6. JVM and JRE both are bundled as a kit, which is JDK (Java Development Kit). 7. Java program is executed, and if we copy the same code to different platform say Linux (where JDK is installed already ) runs the Java code successfully.

Thus Java programming language works in different environments (Operating Systems) and we don’t have to compile the code again, makes Java programming language as Platform-Independent.
Finally like the same process in reverse order the JVM+JRE returns the byte-code from processor and then the byte-code is converted as human readable output by Java compiler once again.

Input Process : Java Program –> Java Compiler –> converts to .class File contains byte-codes –> (JVM+JRE) converts byte-codes as Machine language –> Executed in any Operating System.

Output Process : Output from Operating System processor –> Machine language –> again converted to human readable output by JVM+JRE

Java have some special features which makes java programming language famous.

What is Java decompiler ?

Java decompiler is a compilation process which is capable of converting .class file into Java source code.

Its is used to recover lost source code and explore the source of Java runtime libraries.

What are all the features of Java programming language?

Features of java is listed below.

1. Simple

1. Java is a simple understandable language, anyone can easily learn java program.

2. Object Oriented Language

1. Java is a Object Oriented language which can efficiently handle all the complicated materials in application as Objects.

2. Java can execute the collection of collaborating Objects in an application.

3. Java uses these OOP concepts like Encapsulation, Abstraction, Inheritance and Polymorphism process and executes the code efficiently.

3. Distributed 

1. As said earlier Java is platform independent, the code can be executed in any machine in any network.

2. Java is used in in Application servers / Cluster Servers and also in File Storage Servers in cloud.

3. Java class libraries supports network protocols like TCP, UDP, and basic Socket communication and works excellent and better. 

4. Java class libraries allows even for IPv6 protocols.

4. Robust

1. Java is Robust and it have strong Memory-management process.

2. Java have Garbage collector which is automatic Memory-Management process, it cleans memory occupied by objects that are no longer in use by the program.

5. Secure 

1. Java program runs in Secure container JDK box, byte-code / .class file execution is done by JVM/JRE.

2. Java Byte-code verifier checks for illegal codes and prevents accessing the objects.

3.Java have a security manager which checks the code which classes to be accessed.

6. Architectural neutral

1.Java holds 4 bytes for all primitive data types in both 32bit and 64bit machines irrespective of their architecture. 

7. Portable

1. Java byte-codes can be carried to any machine and executed with the help of JDK.

8. Multithreading

1.Java performs more than one action can be done at the same time within a program.

2. Java utilises same memory and other resources to execute multiple threads at the same time.

9. High Performance

1. Java enables high performance with the use of just-in-time compiler.