Sunday, June 5, 2022

Features of Java

 

Features of Java

  • Simple and Familiar
  • Compiled and Interpreted
  • Platform Independent
  • Portable
  • Architectural Neutral
  • Object-Oriented
  • Robust
  • Secure
  • Distributed
  • Multi-threaded and Interactive
  • High Performance
  • Dynamic and Extensible

Key Features of the Java Language

The Java language provides certain key features that make it ideal for developing server applications. These features include:

Simplicity

Java is simpler than most other languages that are used to create server applications, because of its consistent enforcement of the object model. The large, standard set of class libraries brings powerful tools to Java developers on all platforms.

The syntax of Java is almost similar to C and C++ so that a programmer is familiar with C/C++ does not have to learn the syntax from scratch. But many features of C/C++, which are either complex or result in ambiguity have been removed in Java.

  1. Java does not support multiple inheritance, as the concept is a bit complex and may result in ambiguity. 
  2. Java does not support global variables, which also lead to many bugs in C/C++ programs. 
  3. Java does not use pointers and does not allow pointer arithmetic, which is cause of most of the bugs in C/C++ programs due to inherent complexity. 
  4. Java does not support operator overloading as it may lead to confusion. 
  5. There is no concept of garbage value in Java. We have to initialize variables before use. 

Portability

Java is portable across platforms. It is possible to write platform-dependent code in Java, and it is also simple to write programs that move seamlessly across systems.

Java programs are platform independent. They follow the policy of write-once-run-anywhere. A Java program written for Windows Platform can run on any other platform (Unix, Linux, Sun Solaris etc.) simply by copying the bytecode (“.class” files). 

There is no need to copy the source code and compile it again as in case of a C/C++ program. This feature has made the Java a powerful language. We can run bytecode on any machine provided that the machine has the JVM. 

JVM is itself is platform dependent but it makes the Java code platform independent. It is actually JVM which converts the bytecode into machine code and executes them

Automatic storage management

A JVM automatically performs all memory allocation and deallocation while the program is running. Java programmers cannot explicitly allocate memory for new objects or free memory for objects that are no longer referenced. Instead, they depend on a JVM to perform these operations. The process of freeing memory is known as garbage collection.

Strong typing
Before you use a field, you must declare the type of the field. Strong typing in Java makes it possible to provide a reasonable and safe solution to interlanguage calls between Java and PL/SQL applications, and to integrate Java and SQL calls within the same application.
No pointers

Although Java is quite similar to C in its syntax, it does not support direct pointers or pointer manipulation. You pass all parameters, except primitive types, by reference and not by value. As a result, the object identity is preserved. Java does not provide low level, direct access to pointers, thereby eliminating any possibility of memory corruption and leaks.

Exception handling

Java exceptions are objects. Java requires developers to declare which exceptions can be thrown by methods in any particular class.
Flexible namespace

Java defines classes and places them within a hierarchical structure that mirrors the domain namespace of the Internet. You can distribute Java applications and avoid name collisions. Java extensions, such as the Java Naming and Directory Interface (JNDI), provide a framework for multiple name services to be federated. The namespace approach of Java is flexible enough for Oracle to incorporate the concept of a schema for resolving class names in full compliance with the JLS.

Security

The design of Java bytecodes and JVM specification allow for built-in mechanisms to verify the security of Java binary code. Oracle Database is installed with an instance of Security Manager that, when combined with Oracle Database security, determines who can call any Java methods.

Standards for connectivity to relational databases

Java Database Connectivity (JDBC) and SQLJ enable Java code to access and manipulate data in relational databases. Oracle provides drivers that allow vendor-independent, portable Java code to access the relational database.

Robust

Most programs fail one of the two reasons: 

1. Memory Management. 

2. Exceptional conditions at run time. 

While designing the language one of the aim was to ensure that Java programs are as robust as possible i.e. they should rarely fail. So due importance was given to the above two factors in the Java. 

In Java memory allocation and de-allocation is handled in the language itself, which eliminates many problems caused due to dynamic memory management features in C/C++. 

Java also supports object oriented exceptional handling features to handle exceptional conditions, which occur at run-time. This allows a Java program to recover and continue execution even after an exceptional condition occurs.

No comments:

Post a Comment

JIT Details

Every programming language uses a compiler to convert the high-level language code into machine level binary code, because the system unders...