features
feature of java
Java is a powerful programming language designed for multiple platforms and applications. It was initially developed for embedded systems, set-top boxes, and television devices. Over time, it has become one of the most widely used languages for internet-based and enterprise applications.
Java is continuously evolving with new versions and features, and it is used across billions of devices worldwide.
Object Oriented
In Java, everything is treated as an object. Java is based on the object model, which makes it easy to extend and reuse code. As an object-oriented programming language, Java supports the following fundamental concepts of OOP:
- Polymorphism
- Inheritance
- Encapsulation
- Abstraction
- Classes
- Objects
- Instance
- Method
- Message Passing
Platform Independent
Unlike many other programming languages such as C and C++, Java is not compiled into platform-specific machine code. Instead, it is compiled into platform-independent bytecode. This bytecode can be executed on any system with the help of the Java Virtual Machine (JVM).
Java is designed on the principle of Write Once, Run Anywhere (WORA). This means that Java code is not dependent on any specific machine or operating system. Once the code is compiled into bytecode, it can run on any platform.
The JVM is responsible for interpreting the bytecode. Java provides different versions of JVM for different platforms like Windows, Linux, Unix, and Mac. It is the job of the platform-specific JVM to correctly execute the bytecode.
Because of this feature, developers do not need to worry about system compatibility while writing programs in Java. This makes Java a platform-neutral and highly portable language. Java programs can also be distributed over networks and run on different systems without modification.
Simple
Java is designed to be easy to learn. If you understand the basic concept of OOP Java, it would be easy to master.
Java is very easy to learn. It inherits many features from C, C++ and removes complex features like pointers, operator overloading, multiple inheritance, explicit memory allocation etc. It provides automatic garbage collection. With a rich set of libraries with thousands of useful functions, Java makes developers life easy.
Secure
With Java's secure feature it enables to develop virus-free, tamper-free systems. Authentication techniques are based on public-key encryption.
Java is by design highly secure as it is not asking developers to interact with underlying system memory or operation system. Bytecode is secure and several security flaws like buffer overflow, memory leak are very rare. Java exception handling mechanism allows developers to handle almost all type of error/exceptions which can happen during program execution. Automatic garbage collection helps in maintaining the system memory space utilization in check.
Architecture-Neutral
Java compiler generates an architecture-neutral object file format, which makes the compiled code executable on many processors, with the presence of Java runtime system. With advancement in processor architectures or machine specific processors, java code remains independent of any specific requirement of a processor. As java is an open standard, even a specific JVM can be prepared for a custom architecture. As in today's time, we've JVM available for almost all popular platforms, architectures, java code is completely independent. For example, a java program created in Windows machine can run on linux machine without any code modification.
Portable
Being architecture-neutral and having no implementation dependent aspects of the specification makes Java portable. Compiler in Java is written in ANSI C with a clean portability boundary, which is a POSIX subset.
Due to this portability, java was an instant hit since inception. It was particulary useful for internet based application where platforms varied from place to place and same code base can be used across multiple platform. So collaboration between developers was easy across multiple locations.
Robust
Java makes an effort to eliminate error prone situations by emphasizing mainly on compile time error checking and runtime checking. Automatic garbage collection, strong memory management, no pointers, no direct access to system memory, exception handling, error handling are some of the key features which makes Java a Robust, strong language to rely on.
Multithreaded
With Javaβs multithreaded feature, it is possible to write programs that can perform many tasks simultaneously. This design feature allows developers to build interactive applications that run smoothly and efficiently.
A multithreaded program contains two or more parts that can run concurrently, and each part can handle a different task at the same time. This helps in making optimal use of system resources, especially when the computer has multiple CPUs.
By definition, multitasking means that multiple processes share common processing resources such as a CPU. Multithreading extends the concept of multitasking into applications where a single program can be divided into smaller parts called threads.
Each thread can run in parallel. The operating system divides processing time not only among different applications but also among each thread within an application.
Multithreading allows developers to design programs where multiple activities can proceed concurrently within the same program.
Interpreted
Java byte code is translated on the fly to native machine instructions and is not stored anywhere. The development process is more rapid and analytical since the linking is an incremental and light-weight process.
JVM sits in between the javac compiler and the underlying hardware, the javac (or any other compiler) compiler compiles Java code in the Bytecode, which is understood by a platform specific JVM. The JVM then compiles the Bytecode in binary using JIT (Just-in-time) compilation, as the code executes.
High Performance
With the use of Just-In-Time compilers, Java enables high performance. JVM uses JIT compiler to improves the execution time of the program. Below are some general optimizations that are done by the JIT compilers
- Method inlining
- Dead code elimination
- Heuristics for optimizing call sites
- Constant folding
Distributed
Java is designed for the distributed environment of the internet.
Dynamic
Java is considered to be more dynamic than C or C++ since it is designed to adapt to an evolving environment. Java programs can carry extensive amount of run-time information that can be used to verify and resolve accesses to objects on run-time.