Introduction to Java Platform

Submitted by MoumitaMalik on Sun, 05/06/2018 - 03:11

What is Java?

Java is a general-purpose, object-oriented programming language developed by Sun Microsystem in 1991.  It is one of the most used programming languages.

Java Features :

The inventor of Java wanted to design a language which could offer solutions to some of the problems encountered in modern programming. They wanted the language to be not only reliable portable and distributed but also simple, compact & interactive. Attributes of Java are mentioned below - 

  • Compiled & Interpreted 
  • Platform-Independent & Portable
  • Object-Oriented
  • Robust & Secure
  • Distributed 
  • Familiar, Simple & Small
  • Multi-threaded & Interactive
  • High Performance
  • Dynamic & Extensible 

These features have made java the first application language of the word wide. So let's explore each points separately. Before starting, you have to know the basics as follows -

What is PC?

A computer is an electronic device capable of performing computations and it includes a monitor, keyboard, mouse, and memory to store information. The most important component of the computer is a PROCESSOR which does all thinking of computer. Now the question is how the computer does this thinking? How does it understand text, images, videos, etc.? Well for this we have to go to next topic. 

What is Assembly Language?   

An assembly language is a low-level programming language for microprocessors and other programmable devices. Assembly Language is the most elementary form of software development languages. The computer is an electronic device and it can only understand electronic signals or binary signals. 

For example, if you want to perform the addition of 2 numbers, then how are you going to tell the computer? Yes, we are going to use assembly language to get our code executed.

We are going to give the command to a computer in this format as shown below -

  • Store 1st Number at memory location say A
  • Store 2nd Number at memory location say B
  • Add contents of Location A & B
  • Store Results

Note : The above command should follow the order, as written.

But how are we going to do this? Well to get the answer, we need to proceed to next topic. 

What are Assembler and Compiler?

An assembler is basically the connector between Computer & user, which enables software and application developers to access, operate and manage a computer's hardware architecture and components.

An assembler is a type of computer program that interprets software programs written in assembly language into machine language, code and instructions that can be executed by a computer.

A compiler enables to transform computer code, which has been written in one programming language (i,e source language) in to another programming language (i,e target language).  

So coming back to our example of adding 2 numbers, the assembler will convert this code into machine code and give the output. And with the help of Compiler, we can print the result. 

Popular Java Editor :

To write Java programs, a text editor will be needed. There is even more sophisticated IDE (Integrated Development Environment ) available in the market. But for now, one of the following option can be considered:

  • NotepadOn Windows machine, you can use any simple text editor like Notepad, TextPad etc.

  • Netbeans - is a Java IDE that is open source and free which can be downloaded from http://www.netbeans.org/index.html

  • Eclipse - It is also a java IDE developed by the Eclipse open source community and can be downloaded from http://www.eclipse.org/

 

Compiled & Interpreted :

Usually a computer language is either compiled or interpreted. Java combines both these approaches thus making Java a two-stage systm. 1st, Java compiler translates source code into what into what is known as bytecode instructions. Bytecodes are not machine instructions. In the 2nd stage Java interpreter generates machine code that can be directly executed by the machine that is running in the Java program. So, we can conclude that Java is both a compiled & an interpreted language.

 

Platform-Independent & Portable :

The most significant contribution of Java over other languages is its portability. Java program can be easily moved from one computer system to another, anywhere & anytime. Changes & upgrades in operating system, processors and system resources will not force any changes in Java programs. 

Java ensures portability in two ways. 1st, Java compiler generates bytecode instructions that can be implemented on any machine. 2nd, the size of the primitive data types are machine independent.

 

Object-Oriented :

Java is a true object-oriented language. Almost everything in Java is an Object. All program code and data reside within objects & classes. Java comes with an extensive set of classes, arranged in packages, that we can use in our programs by inheritance. The object model in Java is simple & easy to extend. 

Note : We will discuss later in detail about following terms - Objects, Classes, Packages and Inheritance.

 

Objects

 

Robust & Secure :

Java provides many safeguard to ensure reliable code, which make this language as robust. It has strict compile time and run time checking for data type. It is designed as a garbage-collected language relieving the programmers virtually all memory management problems. Java also incorporates the concept of exception handling which captures series errors and eliminates any risk of causing the system. 

Security becomes an important issue for a language that is used for programming on Internet. Threat of viruses & abuse of resources is everywhere. Java system not only verify all memory access but also ensure that without proper authorization no one can gain access to memory locations. 

 

Distributed :

Java is designed as a distributed language for creating applications on network. It has the ability to share both Data & programs. Java application can open & access remote objects on Internet as easily as they can do in a local system. This enables multi programmers at multiple remote locations to collaborate and work together on a single project.

 

Familiar, Simple & Small :

Java is a small & simple language. Many features of C &C++ that are either reduntant or source of unreliable code are not part of Java.

Familiarity is another striking feature of Java. To make the language look familiar to the existing programmers, it was modelled on C & C++. In fact, it's been said like – Java is a simplified version of C++.

 

Set of C, C++ & Java

 

Multi-threaded & Interactive :

Multi-threaded means handling multiple tasks simultaniously. Java supports multi-threaded programs. This means User doedn't need to wait for the application to finish one task before beginning another.

Java run time comes with tools that supports multi-process synchronization & construct smoothly running interactive systems. response.

Java programs support functions wwritten in other languages such as C & C++. These functions are called as native methods. This facility enables the programmers to use the efficient functions available in these language. Native methods are linked dynamically at run time.

 

High Performance :

Java performance is impressive for an interpreted language, mainly due to the us of intermediate bytecode. According to Sun, Java speed is comparable to the native C/C++. Java architecture is also designed to reduce overheads during runtime.

 

Dynamic & Extensible :

Java is a dynamic language. Java is capable of dynamically linking in new class libraries, methods and objects. Java can also determine the type of class through a query, making it possible to either dynamically link or abort the program, depending on the response.

Java programs support functions written in other languages such as C & C++. These functions are known as native methods. This facility enables the programmers to use the efficient functions available in these languages. Native methods are linked dynamically at run time.

Comments

Related Items

Introduction to Java Virtual Machine (JVM) and its Architecture

The Java compiler produces an intermedia code known as bytecode for a machine that does not exist. This machine is called the Java Virtual Machine and it exists only inside the computer memory. It's a simulated computer within the computer ...