Today Java is used by 9 million+ developers. Java is indeed the most common and commonly used language of programming on Earth. Ever wondered, what's the reason behind its popularity? answer is it’s Features. The Java features are the main reason why it is called the"King of All Programming Languages."
Table of Contents[hide]
2020 is the 25th anniversary of Java . Java's success is further illustrated with Java being used by majority of all Fortune 500 businesses.
The TIOBE Programing Group publishes an index showing the programming languages' popularity. Many times a year, the index is revised. Note that since 2004 Java has consistently occupied the number-one spot on the ranking!.
Nowadays Java is an industrial language, meaning most people in the industry prefer people who know java. Java is now-a -days able to do almost everything. Like web designing, system programming, application programming, graphics, game development, GUI( UI), and may more.
Java's portability leads to its wide use and success but there are other reasons why Java is still preferred by software developers. Lets learn about what java is capable of.
Main Feature of Java are :
Java is a simple, easy to learn language as it is derived from C++. So it is easier for programmers to understand Java who knows C++ from before. Its syntax is quite simple, well structured and clean.
Java does not follow the confusing and ambiguous concepts of C++ like pointers and Operator Overloading etc which are still an important part of C++.
Java also has an automatic garbage collection facility, so you don't have to manually delete unreferenced objects.
Java is a platform independent language that follows the logic of WORA("Write once, Run anywhere").
Java code written in a source file with .java extension is compiled by Java compiler into Bytecode with .class extension. Bytecode is a software that is written in such a way that it can run into multiple platforms hence bytecode can also be referred to as platform independent code.
All operating systems cannot understand the java bytecode, we need a software to be installed in the system in which we want to run java code i.e JVM(Java Virtual Machine).
Piece of code written on one system that can be expected to run on any other java-enabled system.
A Java compiler is a program that takes the .java source file and compiles it into a platform-independent .class java file called bytecode.
Java Bytecode is a machine code/software in the form of .class file that can run into multiple platforms with the help of JVM.
JVM is a sofware that reads Bytecode and converts it into the OS understandable language,it resides in the real machine and provide the runtime environment in which Java code can be executed.
OOP is a programming style which is associated with the concept of Class and Objects which incorporates some data and behaviour. Everythinig in java is modeled around "objects".
Object-oriented programming(OOPs) simplifies the development and maintenance of software by introducing certain rules.
Object-oriented programming(OOPs) has the following concepts :
We will discuss about these concepts in detail later.
Literal meaning of robust is strong. Java is robust programming language because it has the following concepts :
Runtime exceptions represent problems that are detected by the runtime system. This includes arithmetic exceptions (such as dividing by zero), pointer exceptions (such as attempting to access an object by a null reference), and indexing exceptions (such as attempting to access an array element by an index that is too big or too small).
Java garbage collection is an automatic process. It is a mechanism for Java programs to manage automatic memory. Java programs compile bytecodes which can be run on a Java Virtual Machine, or short JVM
When a Java programs run on JVM, objects are created the heap in Java. Garbage Collection tracks each and every object available in the JVM heap space and removes unused ones.
Java handles the memory itself and requires no specific programmer interference. Java has automated memory management, a good and quiet garbage collector that works to clean up unused objects and free up some memory in the background.
Lack of pointer in Java makes it quite secure, hence security is the main reason why we can call java a robust language.
Java has its own memory management mechanism. It has automatic garbage collection system. User need not to worry about freeing memory.It significantly reduces the overhead of the programmer. It will also be helpful for security. It will be helpful for security also.
Java does not support pointers mechanism because these pointers can point to any arbitrary memory locations to do unauthorized read and write operations. This will be big loop hole for security. Thats why Java does not use this pointers concept. So user can’t point any memory locations of other programs or system applications.
Other reasons include use of Access Specific Keywords, Compile Time Checking, Exception Handling, Byte Code Verifier, Cryptographic Security, Java Sandbox, Java Security Manager, Java Class Loader etc.
The bytecode verifier checks if the bytecode provided is valid and do not breach java's security restrictions.The JIT (Just-in-Time) compiler compiles the program one bytecode at a time and runs the program
The Security Manager is a class in the java.lang package that allows systems to implement the security policy. It takes care of system resources accessed by authorized classes only.
The Java ClassLoader is a part of the Java Runtime Environment that dynamically loads Java classes into the Java Virtual Machine.
Java is portable as we can run java bytecode in any of the platform as it is platform independent. Bytecode is highly optimized set of instructions which is executed by JVM.
java is distributed because it can be used to create distributed applications. We can divide the programs into smaller sets and thus can store them on different computers. Java programmers can access programs that are running on different machines.
Java helps us to achieve this by providing the concept of RMI (Remote Method Invocation) and EJB (Enterprise JavaBeans).
Java can perform multiple tasks at once by defining multiple threads. It shares a common memory area.
The main purpose of multithreading is to ensure the simultaneous execution of two or more parts of the program in order to maximize the use of CPU time.