Advantages of Java

In this section, we’ll discuss about the advantages of Java.

Java is Simple

Java is easy to learn and use.

If you know the basics of Object Oriented Programming, you can easily learn Java.

Java is Platform Independent

One of the main reasons Java is so popular is its platform independence, which means Java programs can run on many types of computers. In other words, applications written on one platform can be easily ported to another platform.

Specifically, a Java program runs on any computer with Java Runtime Environment (JRE). JRE is available for many types of computers.

Java is Object Oriented

Java is an object-oriented programming language.

It means that your programs are built with objects. Objects are programming entities that represent real-world objects.

You will learn more about objects later in this book.

Java includes Automatic Memory Management

In programming, you can take a portion of your computers memory. This is known as memory allocation. You can then store data there.

You can safely ignore the mechanisms of allocating the memory. But in many programming languages, you need to safely tell what happens to the memory when you no longer need it.

For example, in C and C++ you have to write code that will release the memory your program allocated.

If you forget this, your program will cause a memory leak. Which means your program will soon run out of memory.

However, in Java you don’t have to release memory. Java does it for you!

The Java Virtual Machine (JVM) has a special component called the garbage collector. It automatically releases memory that is no longer in use.

Java is Concurrent

Java allows two or more parts of your program to run simultaneously. This allows your program to use multiple CPU cores efficiently.

Java is Secure

Java is a secure programming language.

  • You don’t have to deal with pointers.
  • You can’t access arrays with illegal indexes.

Thus, several security flaws like stack corruption or buffer overflow are impossible to exploit.