The objective of the Java programming language is to provide portability, security, and simplicity. In spite of this, Java have number of feature that makes it a popular language of programming. Below is the list of important feature of Java.
- Object-Oriented: Everything is an object in Java language. Object-oriented means we organize our application as a combination of different type of objects that contains both data and behavior.
Basic concepts of Object-Oriented Programming are:
- Simple: The language is easy to learn because its syntax is simple and easy to understand. It has also removed many complicated methods as compared to C++ (i.e. explicit pointers, operator overloading, etc…).
- Platform Independent: Java is different from other programming languages such as C and C++ which are compiled as platform-specific. But Java is platform-independent, it is guaranteed to be write-once, run-anywhere language.
Java provides a software-based platform for different operating system that has two components:
- Runtime Environment
- API(Application Programming Interface)
The codes written in Java can run on multiple platforms such as Windows, Linux, MAC/OS, etc… Codes are compiled by the compiler and converted in bytecode which is platform-independent. These bytecodes are portable and can be run on multiple platforms. This is why Java is a WORA (Write Once Run Anywhere) programming language.
- Secure: Java is the most secure language as it provides a runtime environment with almost zero interaction with the system operating system. Without potential risk to system or users, a Java program can run safely because of the customizable “Sandbox” based security model.
Security features- Cryptography, Authentication and Authorization, public key infrastructure and many more are built-in.
- Robust: Java have strong memory management and error handling feature. It eliminates the error-prone situation by emphasizing mainly compile-time error checking and runtime error checking. Java provides the feature of automatic Garbage Collection to get rid of the objects that are useless in the application, to free up the memory.
- Architecture-neutral: Java language is architecture-neutral because of having no implementation dependent aspect, which makes the compiled code executable on many processors using JRE.
- Portable: Due to no implementation dependency, compiled codes are executable on many processors using JRE. This points out that it is portable.
- Multi-threaded: With this feature, the Java application can perform many tasks simultaneously. Thread is the separate program, executing concurrently. The advantage of using multi-threading is that it shares the common memory area so no memory will be wasted.
- Interpreted: Bytecodes in Java is translated on the fly to native machine instruction and is not stored anywhere.
- High Performance: By using JIT (Just in time compiler) the performance gets enhanced.
- Distributed: Java provides the facility to create a distributed application. RMI and EJB are used to develop distributed applications. It enables us to access the files by calling the methods from any machine on the internet.
- Dynamic: It is a dynamic language as it supports dynamic loading of classes, i.e. the class files are loaded at the runtime. Java has the feature of automatic memory management that makes it dynamic.