What are the features of a Java language ?
The following are the features of a Java language.
- Platform independent
- Open Source
- High performance
- Exception handling
- Architecture neutral
Java is said to be simple because it follows the basic syntax and concept of C and C++ programming language. It is easy to understand and write. It does not support complex features like Pointer and Operator Overloading,etc.
Java follows object oriented programming approach to develop quality softwares and to speed up the software development process. Some of the basic concepts of object oriented approach are as under:
- Data abstraction
3. Platform independent
- Java is said to be platform independent because java source code once compiled can be executed on any platform (operating system), but the operating system must have JDK (Java Development Kit).
- Java compiler converts the java source code into bytecode which can be executed on any platform using JVM (Java Virtual Machine).
- The bytecode is platform independent and can be run on multiple platforms that’s why it is also known as WORA (Write Once Run Anywhere)
NOTE: bytecode is platform independent whereas it is JVM dependent.
4. Open Source:
Open source not only means that the java software is free to use but also one can download java compiler source code publicly. Even one can make commercial use of java software.
From January,2019 Oracle has announced that Java SE 8 updates will no longer be freely available for business, commercial or production use but will remain free for general computing purposes.
- Multi-threaded feature of Java provides Java the capabilities to execute multiple thread simultaneously.
- Multi-threading in Java is used to achieve multitasking.
- Thread is defined as a sub-weight light process.
- Each thread executed under the processor has a separate path of execution and shares a common memory area.
- It increases the processor utilization by executing multiple threads concurrently.
6. High performance:
- Java is said to be high performance because of JIT (Just In Time Compiler).
- Java is faster than other traditional interpreted language because it is nearest to machine native code.
- JIT compiler helps the compiler to compile the code on demand basis. It means which ever method is called only that method block gets executed thus making the compilation fast and efficient.
7. Exception Handling
- Exception handling is one the powerful feature of Java which is responsible to maintain the normal flow of execution of any application.
- Exception generally interrupts the normal flow of any application. So, to handle the exceptions which occurs at runtime or compile time Exception Handling is used.
- Exception is referred to as an interrupt which stops the normal flow of execution of any program. In Java exception is an object which is thrown at run time.
- Java provides enough security while running or developing java programs.
- Java is more secure than other traditional programming language because it do not uses the concept of pointer. Though pointer is secure to some extend but it some cases it leads to unauthorized memory access.
- Java uses Byte code verifier which is responsible to detect errors and warns the programmer before the system crashes.
- Java has automatic garbage collection facility which frees the memory from time to time when there need arises thus improving the data security and also reduces the overhead of the system.
- Java easily supports TCP, UDP and basic Socket communication protocols to work in distributed environment.
- Applet running in a browse in an example of Distributed application.
- Distributed feature of Java gives the capabilities to work in a client server environment.
- Java programs can make remote procedure calls, access remote databases, and clustering features to produce a single result.
- RMI and EJB are used to implement Distributed application.
- Java is strongly typed language and has capabilities to perform actions at compile time as well as run time.
- Java is said to be a dynamic language because it supports dynamic loading of classes. It means classes are loaded on demand.
- Java provides dynamic operations such as dynamic object creation, dynamic array, etc. at the same time it also supports dynamic compilation and automatic garbage collection.
11. Architecture neutral
- Java compiler generates neutral object file format which is capable to run on any processor with the presence of Java runtime system.
- Java compiler do not creates the object code directly, rather the source code is first converted to byte code which acts as an intermediate code. Thus, based on different architecture of the machine the byte code is further converted to object code by Java interpreter.
- Java has no dependent features such as: int data type occupies 4 bytes of memory for both 32-bit and 64-bit system architecture whereas in C language it occupies 2 bytes for 32-bit system and 4 bytes for 64-bit system architecture. Thus, the data type in java is fixed and it remains neutral with respect to different machines.
- Java is said to be interpreted because the compilation process it done in two phases. In first phase compiler converts the source code into byte code and in second phase java interpreter reads the compiled byte code and converts it into object code (i.e. machine code) for execution.
- As we also know that JVM (Java Virtual Machine) is operating system dependent. The interpreter of Java is responsible for converting the byte code into specific operating system machine code.