There is given many features of java. They are also known as java buzzwords. The Java Features given below are simple and easy to understand.
- Simple
- Object-Oriented
- Platform independent
- Secured
- Robust
- Architecture neutral
- Portable
- Dynamic
- Interpreted
- High performance
- Multithreaded
- Distributed
Simple:
According to Sun, Java language is simple because:
- The syntax is based on C++ (so easier for programmers to learn it after C++).
- Removed many confusing and/or rarely-used features e.g., explicit pointers, operator overloading, etc.
- No need to remove unreferenced objects because there is an Automatic Garbage Collection in java.
- And also removed many other confusing and/or rarely used features like explicit pointers, operator overloading, etc.
Object-oriented:
Object-oriented means we organize our software as a combination of different types of objects that incorporates both data and behaviour. Object-oriented programming(OOPs) is a methodology that simplifies software development and maintenance by providing some rules.
The basic concepts of OOPs are:
- Object
- Class
- Inheritance
- Polymorphism
- Abstraction
- Encapsulation
Platform independent:
A platform is the hardware or software environment in which a program runs. There are two types of platforms software-based and hardware-based. Java provides a software-based platform. The Java platform differs from most other platforms in the sense that it is a software-based platform that runs on top of other hardware-based platforms. It has two components:
- Runtime Environment
- API(Application Programming Interface)
Java code can be run on multiple platforms e.g. Windows, Linux, Sun Solaris, Mac/OS, etc. Java code is compiled by the compiler and converted into bytecode. This bytecode is a platform-independent code because it can be run on multiple platforms i.e. Write Once and Run Anywhere(WORA). Java solves the problem of platform independence by using byte code. The Java compiler does not produce native executable code for a particular machine as a C compiler does. Instead, it produces a special format called byte code. Java byte code written in hexadecimal, byte by byte, looks like this: CAFEBABE0003002D003E08003B080001 080020
Secured:
Java is a secure programming language because:
- No explicit pointer.
- Program run inside a virtual machine sandbox.
- Array index limit checking.
- Code pathologies reduced by :
- Bytecode verifier – Checks classes after loading (code fragments for illegal code that can violate access right to object.)
- Classloader – confines objects to unique namespaces. Prevents loading a hacked “java.lang.SecurityManager” class.
- Security manager – determines what resource a class can access such as reading and writing to the local disk.
Robust:
Robust simply means strong. Java uses strong memory management. There is a lack of pointers that avoids security problems. There is automatic garbage collection in java. There is exception handling and type-checking mechanism in java. All these points make java robust.
Architecture-Neutral:
There are no implementation-dependent features e.g. size of primitive types is fixed. In C programming, the int data type occupies 2 bytes of memory for 32-bit architecture and 4 bytes of memory for 64-bit architecture. But in java, it occupies 4 bytes of memory for both 32 and 64-bit architectures. A Language or Technology is said to be Architectural neutral and can run on any available processors in the real world without considering their architecture and vendor (providers) irrespective of its development and compilation.
Portable:
The code which is converted by the java compiler(javac) is called byte code in java and the code which is converted by the java compiler (javac) is non-executable. Byte code is a highly optimized set of instructions. It is executed by the Javarun-time system, which is called the java virtual machine (JVM). And it is the intermediate language of source code and executable code. JVM converts the byte code of java into machine language to execute the microprocessor of OS. However internal details of JVM will differ from platform to platform but still, all JVM understands the same java bytecode. Or in other words, we can say JVM is platform dependent and java byte code is platform independent.
High performance:
It has high performance because of the following reasons:
- This language uses Bytecode which is faster than ordinary pointer code so the Performance of this language is high.
- The garbage collector collects unused memory space and improves the application’s performance.
- It has no pointers so using this language we can develop an application very easily.
- It supports multithreading, and because this time-consuming process can be reduced to execute the program.
Networked:
It is mainly designed for web-based applications, and J2EE is used for developing network-based applications.
Dynamic:
It supports Dynamic memory allocation due to this memory wastage is reduced and improves the performance of the application. The process of allocating the memory space to the input of the program at run-time is known as dynamic memory allocation, To program to allocate memory space dynamically we use an operator called’new”new’ operator known as the dynamic memory allocation operator.
Distributed:
We can create distributed applications in java. RMI and EJB are used for creating distributed applications. We may access files by calling the methods from any machine on the internet.
Multi-threaded:
A thread is like a separate program, executing concurrently. We can write Java programs that deal with many tasks at once by defining multiple threads. The main advantage of multi-threading is that it doesn’t occupy memory for each thread.