Java has many important features that makes java one of the most useful programming language today. As the time passes, java has emerged as one of the most preferable programming language for different types of need. This tutorial will cover some of it's features which makes it one of the most useful language.
1. Java is Platform Independent
Java is a platform independent language which means java is
not dependent on any platform(operating system).
Program written and compiled on any operating system can be
run on any other operating system. All you need is the generated
.class file of
your machine. Copy this
.class file on your new machine, install JVM of corresponding OS on new machine if not already installed,
now you can run your
.class file using the JVM on new machine. You don't need the original
.java file on new machine to run the program.
In other way we can say java provides the facility of "Write Once - Run Anywhere"(WORA
also known as Platform Independent) feature.
2. Java is Object Oriented
Java is an object oriented programming language because java supports the characteristics of Object Oriented Programming(OOPs) paradigm like Encapsulation, Inheritance, Abstraction Polymorphism etc. Everything in java plays around objects. Programming languages like C, FORTRAN, PASCAL etc focuses on logics while java focuses on objects. An object contains data in the form of fields(instance variable or attribute) and code in the form of methods.
3. Java is Simple
Java is a simple language because it's syntaxes are very similar to C++ syntaxes, it also provides automatic memory management through garbage collection. Programmers don't have to focus on complex memory management. Apart from this java contains a lot of predefined class libraries to support different features. Java does not support some of the complex features like operator overloading, multiple inheritance etc. There is no concept of pointers in java that confuses programmers a lot.
4. Java is Secure
Java is secure because it has features like automatic memory management, no explicit pointer, bytecode verifier etc. that enhances the security of java programs. As java does not have concept of pointer and provides the automatic memory management, this reduces the chances of memory leak. Bytecode verifier ensures that .class files are not edited explicitly, any external edit will fail the program to run. Java program runs in a different runtime environment that also enhances it's security. These features together makes java one of the most secured language.
5. Java is Portable
Java portability allows java program to run on different
machines without any change in program. If the machine changes or the configuration(hardware,
operating system or both) of existing machine changes, same java
program can be executed on new machine as well. Java's
Write once - Run anywhere feature makes the java as a portable
language. Java was designed with a goal that if new architectures
are developed, the java environment could be ported easily. While
porting all you need to have is the
.class files of application on
existing machine. Just copy these
.class file on new machine and run your application using the java virtual machine of new
6. Java is Distributed
Java is also called a distributed language. This means java programs running on one machine can easily access the resources(files, java objects etc) of other machine on internet. Java provides class libraries for high-level support of networking. Remote method invocation(RMI) API's allow java programs to call methods of remote java objects, as if they were local objects. We can also say, same or different applications running on different JVM on different machines can interact with each other for sharing data over the internet. RMI and EJB are mostly used for distributed programming.
7. Java is Multithreaded
Java is a multithreaded programming language. In multithreaded programming two or more than two parts of a program can execute simultaneously. That means a single program can do two or more than two things simultaneously. Each part of such program is called a thread and each thread starts a separate path of execution. Multithreading is a special form of multitasking. For example in a multithreaded program you can read a file in one thread and can write into a different file in other thread simultaneously.
8. High Performance
Though java is not as fast as compiled languages like C, C++ but java still has some of the good features like just-in-time compiler, multithreading, garbage collection etc that increases the performance of java near to compiled languages.
9. Java is Robust
Robust simply means something that is strong. Java has the strong memory allocation and automatic garbage collection mechanism. Java also strongly checks for error in program at compile and runtime both. These features makes java as a robust language.
Java is a dynamic language because some of the features like memory management, dynamic binding etc happens on runtime. Dynamic feature of java allows to load the classes at runtime from remote locations as well.
Java is a highly interpreted language. Feature like just-in-time compilation reduces interpretation time.
12. Architecture Neutral
Java is an architecture neutral language because it does not depend on architecture(organization of processor, memory, cpu input/output etc,) of a computer. Hence java can be run on any computer architecture. As bytecode are platform independent, it also makes java as an architecture neutral language, something which is not dependent strongly on specific system configuration.
- If java was not platform independent, programmer would have to write same program differently for different operating system.
- Java is not fully object oriented because it supports Primitive data-type such as int, byte, long... etc. to be used, which are not objects.
- Java is not as fast as C or C++, because these language converts source code directly to machine code, yet java is a high performance language.