Java is a widely used programming language expressly designed for use in the distributed environment of the internet. It is the most popular programming language for Android smartphone applications and is also among the most favored for the development of edge devices and the internet of things.

Java was designed to have the look and feel of the C++ programming language, but is simpler to use and enforces an object-oriented programming model. Java can be used to create complete applications that may run on a single computer or be distributed among servers and clients in a network. It can also be used to build a small application module or applet for use as part of a webpage.

Why Java is popular

It is difficult to provide a single reason as to why the Java programming language has become so ubiquitous. However, the language's major characteristics have all played a part in its success, including the following components:

  • Programs created in Java offer portability in a network.  Source code is compiled into what Java calls bytecode, which can run anywhere in a network, on a server or on a client that has a Java virtual machine (JVM). The JVM interprets the bytecode into code that will run on computer hardware. In contrast, most programming languages, such as COBOL or C++, will compile code into a binary file. Binary files are platform-specific, so a program written for an Intel-based Windows machine cannot on run a Mac, a Linux-based device or an IBM mainframe. As an alternative to interpreting one bytecode instruction at a time, the JVM includes an optional just-in-time (JIT) compiler which dynamically compiles bytecode into executable code. In many cases, the dynamic JIT compilation is faster than the virtual machine interpretation.
  • Java is object-oriented. An object is made up of data as fields or attributes and code as procedures or methods. An object can be a part of a class of objects to inherit code common to the class. Objects can be thought of as "nouns" that a user can relate to "verbs." A method is the object's capabilities or behaviors. Because Java’s design was influenced by C++, Java was mainly built as an object-orientated language. Java also uses an automatic garbage collector to manage object lifecycles. A programmer will create objects, but the automatic garbage collector will recover memory once the object is no longer in use. However, memory leaks may occur when an object which is no longer being used is stored in a container.
  • The code is robust. Unlike programs written in C++, Java objects contain no references to data external to themselves or other known objects. This ensures that an instruction cannot include the address of data stored in another application or in the operating system itself, either of which would cause the program and perhaps the operating system to terminate or crash. The JVM makes a number of checks on each object to ensure integrity.
  • Data is secure. Unlike C++, Java does not use pointers, which can be unsecured. Data converted to bytecode by Java is also not readable to humans. Additionally, Java will run programs inside a sandbox to prevent changes from unknown sources.
  • Applets offer flexibility. In addition to being executed on the client rather than the server, a Java applet has other characteristics designed to make it run fast.
  • Developers can learn Java quickly. With syntax similar to C++, Java is relatively easy to learn, especially for those with a background in C.
Features of Java

A common misconception is that there is an association between Java and JavaScript. The two languages share similarities in syntax, but are two very different constructs.

Java platforms

The three key platforms upon which programmers can develop Java applications are:

  1. Java SE- Simple, stand-alone applications are developed using Java Standard Edition. Formerly known as J2SE, Java SE provides all of the APIs needed to develop traditional desktop applications.
  2. Java EE- The Java Enterprise Edition, formerly known as J2EE, provides the ability to create server-side components that can respond to a web-based request-response cycle. This arrangement allows the creation of Java programs that can interact with Internet-based clients, including web browsers, CORBA-based clients and even REST- and SOAP-based web services.
  3. Java ME- Java also provides a lightweight platform for mobile development known as Java Micro Edition, formerly known as J2ME. Java ME has proved a prevalent platform for embedded device development, but it struggled to gain traction in the smartphone development arena.
How to install the JDK

Learn how to install Java and the JDK

Main uses of Java

It is easy for developers to write programs which employ popular software design patterns and best practices using the various components found in Java EE. For example, frameworks such as Struts and JavaServer Faces all use a Java servlet to implement the front controller design pattern for centralizing requests.

A big part of the Java ecosystem is the large variety of open source and community built projects, software platforms and APIs. For example, the Apache Foundation hosts a variety of projects written using Java, including simple logging frameworks for Java (SLF4J), both Yarn and Hadoop processing frameworks, Microservices development platforms and integration platforms.

Java EE environments can be used in the cloud as well. Developers can build, deploy, debug and monitor Java applications on Google Cloud at a scalable level.

In terms of mobile development, Java is commonly used as the programming language for Android applications. Java tends to be preferred by Android developers because of Java’s security, object-oriented paradigms, regularly updated and maintained feature sets, use of JVM and frameworks for networking, IO and threading.

Although Java is widely used, it still has fair criticisms. Java syntax is often criticized for being too verbose. In response, several peripheral languages have emerged to address these issues, including Groovy. Due to the way Java references objects internally, complex and concurrent list-based operations slow the JVM. The Scala language addresses many of the shortcomings of the Java language that reduce its ability to scale.

History of Java

The internet and the World Wide Web were starting to emerge in 1996 and Java was not originally designed with the internet in mind. Instead, Sun Microsystems engineers envisioned small, appliance-sized, interconnected devices that could communicate with each other.

As a result, the Java programming language paid more attention to the task of network programming than other competing languages. Through the APIs, the Java programming language took large strides in simplifying the traditionally difficult task of programming across a network.

The first full increment of Java occurred on Jan. 23, 1996. The well-known JavaBeans interface was introduced in Java 1.1 in February 1997.

Later versions of Java releases have received nicknames, such as JDK 1.2 being referred to as Java 2. Java 2 saw considerable improvements to API collections, while Java 5 included significant changes to Java syntax through a new feature called Generics.

In October 2009, Google released the Android software developer's kit (SDK), a standard development kit that made it possible for mobile device developers to write applications for Android-based devices using Java APIs.

Oracle Corp. took over the Java platform when it acquired Sun Microsystems in January 2010. The acquisition delayed the release of Java 7, and Oracle scaled back some of the more ambitious plans for it.

Java 8 was released in March 2014. It included lambda expressions, which are common features in many competing languages but had been absent in Java. With Lambda expressions, developers can write applications using a functional approach, as opposed to an object-oriented one.

March of 2018 saw the release of Java 10 followed by Java 11 in September 2018. Java 12 was released in March of 2019.

Oracle vs. Google lawsuit: Java and Android

On Aug. 10, 2010, Oracle launched the first of two lawsuits against Google, the second of which sought $8.8 billion in damage over the use of the Java programming language in the Android SDK.

Oracle alleged copyright infringement and that Google's implementation of various Java APIs used code copied directly from Oracle's implementation. The litigation ended in May 2016 as both trials found in favor of Google. Jurors decided that Android's use of the Java APIs constituted fair use and awarded no damages to Oracle.

As of 2016, more than half of all handheld phones in the world run on Android, giving Java an incredibly strong hold in the smartphone market.

This was last updated in April 2019

Continue Reading About Java

Dig Deeper on Software development best practices and processes

App Architecture
Software Quality
Cloud Computing