Features of Java / Characteristics of Java
Java Language Mostly Used, Due to the Features provided by the Java Language.
These Features are commanly
1. Simple
2. Portable
3. Platform independent
4. Object-Oriented
5. Secured
6. High Performance
7. Robust
8. Dynamic
9. Distributed
10.Interpreted
11. Multithreaded
12. Architecture neutral
Simple:
Java is simple language and easy to learn. Its syntax is simple, clean and easy to understand. According to Sun, Java language is a simple programming language.
Portable
Java is portable because it facilitates you to carry the Java bytecode to any platform. It doesn't require any implementation.
Platform Independent
Java is a platform-independent language. because you can write your code once and then run it anywhere, on any platform that provides the environment to run it. This environment name is the Java Virtual Machine (JVM). The JVM must be present in your system to execute the java code. The JVM is different for each platform (operating system) like windows, Unix. In the case of Java, platform independence does not mean that you can run the code anywhere; you can run it wherever the environment is provided. This is the key point of platform independence in Java.
Object-oriented
Java is an object-oriented programming language. Everything in Java is an object. Object-oriented means we organize our software as a combination of different types of objects that incorporates both data and behavior.
Object-oriented programming (OOPs) is a methodology that simplifies software development and maintenance by providing some rules.
Basic concepts of OOPs (Object Oriented Programming Structure) are:
1. Object
2. Class
3. Inheritance
4. Polymorphism
5. Abstraction
6. Encapsulation
Secured
Java is best known for its security. With Java, we can develop virus-free systems. Java is secured because:
Java Never used Explicit Pointer.
Java Programs run inside a virtual machine sandbox or used Java Virtial Envirement (JVM).
Classloader: Classloader in Java is a part of the Java Runtime Environment(JRE) which is used to load Java classes into the Java Virtual Machine dynamically. It adds security by separating the package for the classes of the local file system from those that are imported from network sources.
Bytecode Verifier: It checks the code fragments for illegal code that can violate access right to objects.
Security Manager: It determines what resources a class can access such as reading and writing to the local disk.
Java language provides these securities by default. Some security can also be provided by an application developer explicitly through SSL, JAAS, Cryptography, etc.
Robust
Robust simply means strong. Java is robust because:
1. It uses strong memory management.
2. There is a lack of pointers that avoids security problems.
3. There is automatic garbage collection in java which runs on the Java Virtual Machine to get rid of objects which are not being used by a Java application anymore.
4. There are exception handling and the type checking mechanism in Java. All these points make Java robust.
High-performance
Java is faster than other traditional interpreted programming languages because Java bytecode is "close" to native code. It is still a little bit slower than a compiled language (e.g., C++). Java is an interpreted language that is why it is slower than compiled languages, e.g., C, C++, etc.
Dynamic
Java is a dynamic language. It supports dynamic loading of classes. It means classes are loaded on demand. It also supports functions from its native languages, i.e., C and C++.
Java supports dynamic compilation and automatic memory management (garbage collection).
Distributed
Java is distributed because it facilitates users to create distributed applications in Java. RMI and EJB are used for creating distributed applications. This feature of Java makes us able to 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. It shares a common memory area. Threads are important for multi-media, Web applications, etc.
Architecture-neutral
Java is architecture neutral because there are no implementation dependent features, for example, the size of primitive types is fixed.
In C programming, int data type occupies 2 bytes of memory for 32-bit architecture and 4 bytes of memory for 64-bit architecture. However, it occupies 4 bytes of memory for both 32 and 64-bit architectures in Java.