0% found this document useful (0 votes)
21 views

Java History

- Java was created in 1990 by James Gosling at Sun Microsystems to allow the company to enter the emerging internet world. - The first release of Java was in 1996 and it has since become one of the most widely used programming languages. - The book will provide an overview of Java's history and evolution from version 1.0 through the current version 17, covering changes in the language and virtual machine over time.

Uploaded by

H-Kati
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views

Java History

- Java was created in 1990 by James Gosling at Sun Microsystems to allow the company to enter the emerging internet world. - The first release of Java was in 1996 and it has since become one of the most widely used programming languages. - The book will provide an overview of Java's history and evolution from version 1.0 through the current version 17, covering changes in the language and virtual machine over time.

Uploaded by

H-Kati
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 31

CHAPTER 1

An Introduction to Java
and Its History
According to Google Search, at the end of 2020, 9492 companies reportedly use Java
in their tech stacks, including Google and the company that I, the author of this book,
worked for while this book was being written. Even after 25 years, Java continues to
be one of the most influential programming languages. It all started in 1990, when
an American company that was leading the revolution in computer industry decided
to gather its best engineers to design and develop a product that would allow them
to become an important player in the new emerging Internet world. Among those
engineers was James Arthur Gosling, a Canadian computer scientist who is recognized
as the father of the Java programming language. It would take five years of design,
programming, and one renaming (from Oak to Java because of trademark issues), but
finally, in January 1996,1 Java 1.0 was released for Linux, Solaris, Mac and Windows.
The general tendency when reading a technical book is to skip the introductory
chapter altogether. But in this case I think it would be a mistake. I was never much
interested in the history of Java until I wrote this book. I knew that James Gosling was
the creator and that Oracle bought Sun, and that was pretty much it. I never cared much
about how the language evolved, where the inspiration came from, or how one version
was different from another. I started learning Java at version 1.5, and I took a lot of things
in the language for granted. So when I was assigned to a project running on Java 1.4 I was
quite confused, because I did not know why parts of the code I wrote was not compiling.
Although the IT industry is moving very fast, there will always be that one client that
has a legacy application. Knowing the peculiarities of each Java version is an advantage,
because you know the issues when performing a migration.

1
Reference: https://en.wikipedia.org/wiki/Java_(software_platform).

1
© Iuliana Cosmina 2022
I. Cosmina, Java 17 for Absolute Beginners, https://doi.org/10.1007/978-1-4842-7080-6_1
Chapter 1 An Introduction to Java and Its History

When I started doing research for this book, I was mesmerized. The history of Java
is interesting because it is a tale of incredible growth, success of a technology, and an
example of how a clash of egos in management almost killed the company that created
it. Currently Java is the most-used technology in software development, and it is simply
paradoxical that the company that gave birth to it no longer exists.
This chapter describes each version of Java, tracking the evolution of the language
and the Java Virtual Machine.

Who This Book Is For


Most Java books for beginners start with the typical Hello World! example depicted in
Listing 1-1.

Listing 1-1. The Most Common Java Beginner Code Sample

public class HelloWorld {


    public static void main(String[] args) {
        System.out.println("Hello World!");
    }
}

This code, when executed, prints Hello World! in the console. But if you have bought
this book it is assumed that you want to develop real applications in Java, and have a
real chance when applying for a position as a Java developer. If this is what you want
and if this is who you are, a beginner with the wits and the desire to make full use of this
language’s power, then this book is for you. And this is why I will give you enough credit
to start this book with a more complex example.
Java is a language with a syntax that is readable and based on the English language.
So if you have logical thinking and a little knowledge of the English language, it should
be obvious to you what the code in Listing 1-2 does without even executing it.

2
Chapter 1 An Introduction to Java and Its History

Listing 1-2. The Java Beginner Code Sample a Smart Beginner Deserves

package com.apress.ch.one.hw;

import java.util.List;

public class Example01 {


    public static void main(String[] args) {
        List<String> items = List.of("1", "a", "2", "a", "3", "a");

        items.forEach(item -> {
            if (item.equals("a")) {
                System.out.println("A");
            } else {
                System.out.println("Not A");
            }
        });
    }
}

In this code example, a list of text values is declared; then the list is traversed, and
when a text is equal to “a”, the letter “A” is printed in the console; otherwise, “Not A” is
printed.
If you are an absolute beginner to programming, this book is for you, especially
because the sources attached to this book make use of algorithms and design patterns
commonly used in programming. So if your plan is to get into programming and learn
a high-level programming language, read the book, run the examples, write your own
code, and you should have a good head start.
If you already know Java you can use this book too, because it covers syntax and
under-the-bonnet details for Java versions up to 17 (the Early Access Program or EAP2
release), and you will surely find something you did not know.

2
Early Access Program

3
Chapter 1 An Introduction to Java and Its History

How This Book Is Structured


The chapter you are currently reading is an introductory one that covers a small part of
Java history, showing you how the language has evolved and providing a glimpse into its
future. Also, the mechanics of executing a Java application are covered, so that you are
prepared for Chapter 2. The next chapter will show you how to set up your development
environment and will introduce you to a first simple application.
Starting with Chapter 3, fundamental parts of the language will be covered:
packages, modules, classes, interfaces, annotations objects, operators, data types,
records, statements, streams, lambda expressions, and so on.
Starting with Chapter 8, interactions with external data sources are covered: reading
and writing files, serializing/deserializing objects, and testing and creating an user
interface.
Chapter 12 is dedicated fully to the publish-subscribe framework introduced in Java
9 and reactive programming.
Chapter 13 will cover the Garbage Collector.
All the sources used in the listings in this book, and some that did not make it
because the book must be kept to a reasonable size, are part of a project named
java-17-for-absolute-beginners. This project is organized in modules (thus it
is a multimodule project) that are linked to each other and have to be managed by
something called Maven. Maven is something we developers call a build tool, and it
provides the capability to build projects containing a lot of source code. To build a
project means transforming the code written into something that can be executed. I
choose to use multimodule projects for the books I write because it is easier to build
them and also because common elements can be grouped together, keeping the
configuration of the project simple and nonrepetitive. Also, by having all the sources
organized in one multimodule project, you get the feedback if the sources are working
or not as soon as possible, and you can contact the author and ask them to update them.
I know that having a build tool introduces a certain level of complexity, but it gives you
the opportunity to get comfortable with a development environment very similar to what
you will work in as an employee.

4
Chapter 1 An Introduction to Java and Its History

Conventions
This book uses a number of formatting conventions that should make it easier to read. To
that end, the following conventions are used within the book:

• code or concept names in paragraphs appear as follows:


java.util.List

• code listings appear as follows:

public static void main(String[] args) {


    System.out.println("Hello World!");
}

• logs in console outputs will appear as follows:

01:24:07.809 [main] INFO c.a.Application - Starting Application


01:24:07.814 [main] DEBUG c.a.p.c.Application - Running in
debug mode

• {xx} is a placeholder; the xx value is a pseudo-value giving a


hint about the real value that should be used in the command or
statement.

• appears in front of paragraphs you should pay specific attention


to. There are similar icons for tips and warnings.

• Italic font is used for humorous metaphors and expressions.

• Bold font is used for Chapter references and important terms.

As for my style of writing, I like to write my books in the same way I have technical
conversations with colleagues and friends: sprinkling jokes throughout, giving
production examples, and making analogies to nonprogramming situations. Because
programming is nothing but just another way to model the real world.

When Java Was Owned By Sun Microsystems


The first stable version of Java was released in 1996. Up until that point, there was a
small team named the Green Team that worked on a prototype language named Oak,
which was introduced to the world with a working demo—an interactive handheld home

5
Chapter 1 An Introduction to Java and Its History

entertainment controller called the Star7. The star of the animated touch-screen user
interface was a cartoon character named Duke, created by one of the team’s graphic
artists, Joe Palrang. Over the years, Duke (Figure 1-1) has become the official Java
technology mascot, and every JavaOne conference (organized by Oracle once a year) has
its own Duke mascot personality.

Figure 1-1. Duke, the Java official mascot (image source: https://oracle.com)

The Green Team released Java to the world via the Internet, because that was the
fastest way to create widespread adoptions. You can imagine that they jumped for
joy every time somebody downloaded it, because it meant people were interested in
it. There are a few other advantages making software open source, such as the fact
that contributions and feedback are provided by a big number of people from all over
the world. Thus, for Java, this was the best decision, as it shaped the language a lot of
developers are using today. Even after 25 years, Java is still among the top-three most-­
used programming languages.
The Green Team was working for an American company named Sun Microsystems
and was founded in 1982. It guided the computer revolution by selling computers,
computer parts, and software. One of their greatest achievements is the Java
programming language. In Figure 1-2, you can see the company logo3 that was used
since Java’s birth year until it was acquired by Oracle in 2010.

3
The story behind the logo can be read at “Title,” https://goodlogo.com/extended.info/
sunmicrosystems-logo-2385, accessed October 15, 2021. You can also read more about Sun
Microsystems.

6
Chapter 1 An Introduction to Java and Its History

Figure 1-2. The Sun Microsystems logo (image source: https://en.wikipedia.


org/wiki/Sun_Microsystems)

It is quite difficult to find information about the first version of Java, but dedicated
developers that witnessed its birth, when the Web was way smaller and full of static
pages, did create blogs and shared their experience with the world. It was quite easy for
Java to shine with its applets that displayed dynamic content that interacted with the
user. But because the development team thought bigger, Java became much more than
a Web programming language. In trying to make applets run in any browser, the team
found a solution to a common problem: portability.
Developers nowadays face a lot of headaches when developing software that should
run on any operating system. And with the mobile revolution, things got really tricky. In
Figure 1-3 you can see an abstract drawing of what is believed to be the first Java Logo.

Figure 1-3. The first Java logo, 1996–2003 (image source: https://oracle.com/)

7
Chapter 1 An Introduction to Java and Its History

Java 1.0 was released at the first edition of the JavaOne conference with over 6000
attendees. Java started out as a language named Oak.4 This language was really similar
to C++ and was designed for handheld devices and set-top boxes. It evolved into the first
version of Java, which provided developers some advantages which C++ did not:

• security: In Java, there is no danger of reading bogus data when


accidentally going over the size of an array.

• automatic memory management: A Java developer does not have


to check if there is enough memory to allocate for an object and then
deallocate it explicitly; the operations are automatically handled
by the garbage collector. This also means that pointers are not
necessary.

• simplicity: There are no pointers, unions, templates, structures.


Mostly anything in Java can be declared as a class. Also, confusion
when using multiple inheritance is avoided by modifying the
inheritance model and not allowing multiple class inheritance.

• support for multithreaded execution: Java was designed from the


start to support development of multithreaded software.

• portability: One of the most known Java mottos is Write once,


run anywhere (WORA). This is made possible by the Java Virtual
Machine.

All this made Java appealing for developers, and by 1997, when Java 1.1 was released,
there were already approximately 400,000 Java developers in the world. The JavaOne
conference had 10,000 attendees that year. The path to greatness was set. Before going
further in our analysis of each Java version, let’s clarify a few things.

How Is Java Portable?


I mentioned a few times that Java is portable and that Java programs can run on any
operating system. It is time to explain how this is possible. Let’s start with a simple
drawing, like the one in Figure 1-4.

4
The language was named by James Gosling, after the oak tree in front of his house.

8
Chapter 1 An Introduction to Java and Its History

Figure 1-4. Running a Java program on multiple platforms

Java is what we call a high-level programming language that allows a developer


to write programs that are independent of a particular type of computer. High-level
languages are easier to read, write, and maintain. But their code must be translated by
a compiler or interpreted into machine language (unreadable by humans because is it
made up of numbers) to be executed, because that is the only language that computers
understand.
In Figure 1-4, notice that on top of the operating systems, a JVM is needed to execute
a Java program. JVM stands for Java Virtual Machine, which is an abstract computing
machine that enables a computer to run a Java program. It is a platform-independent
execution environment that converts Java code into machine language and executes it.
So what is the difference between Java and other high-level languages? Well, other
high-level languages compile source code directly into machine code that is designed to
run on a specific microprocessor architecture or operating system, such as Windows or
UNIX. What JVM does is to mimic a Java processor, making it possible for a Java program
to be interpreted as a sequence of actions or operating system calls on any processor
regardless of the operating system. Sure, the compiling step makes Java slower than a
pure compiled language like C++, but the advantage was and is still beautiful. Also, Java

9
Chapter 1 An Introduction to Java and Its History

is not the only member of the JVM languages family. Groovy, Scala, Kotlin, and Clojure
are all very popular programming languages that run on the JVM.
Because the Java compiler was mentioned, we have to get back to Java 1.1, which
was widely used even as new versions were released. It came with an improved Abstract
Window Toolkit (AWT) graphical API (collections of components used for building
applets), inner classes, database connectivity classes (JDBC model), classes for remote
calls (RMI), a special compiler for Microsoft platforms named JIT5 Compiler (for Just
In Time), support for internationalization, and Unicode. What also made it so widely
embraced is that shortly after Java was released, Microsoft licensed it and started
creating applications using it. The feedback helped further development of Java, and
thus Java 1.1 was supported on all browsers of the time, which is why it was so widely
deployed.

 A lot of terms used in the introduction of the book might seem foreign to you
now, but as you read the book, more information is introduced, and these words
will start to make more sense. For now, just keep in mind that every new Java
version has something more than the previous version, and at that time, every new
component was a novelty.

So what exactly happens to the developer-written Java code until the actual
execution? The process is depicted in Figure 1-5.

5
Just In Time

10
Chapter 1 An Introduction to Java and Its History

Figure 1-5. From Java code to machine code

Java code is compiled and transformed to bytecode that is then interpreted and
executed by the JVM on the underlying operating system.

Java is a compiled and interpreted general-purpose programming language


with numerous features that make it well suited for the web.

Now that we’ve covered how Java code is executed, let’s go back to some more
history.

Sun Microsystem’s Java Versions


The first stable Java version released by Sun Microsystems could be downloaded from
the website as an archive named JDK, and its version at the time was 1.0.2. JDK is an
acronym for Java Development Kit. This is the software development environment used
for developing Java applications and applets. It includes the Java Runtime Environment
(JRE), an interpreter (loader), a compiler, an archiver, a documentation generator, and
other tools needed for Java development. We will get into this more in the section about
installing JDK on your computer.

11
Chapter 1 An Introduction to Java and Its History

Starting with version 1.2, released in 1998, Java versions were given codenames.6
The Java version 1.2 codename was Playground. It was a massive release, and this was
the moment when people started talking about the Java 2 Platform. Starting with this
version, the releases up to J2SE 5.0 were renamed, and J2SE replaced JDK because the
Java platform was now composed of three parts:

• J2SE (Java 2 Platform, Standard Edition), which later became JSE, a


computing platform for the development and deployment of portable
code for desktop and server environments.

• J2EE (Java 2 Platform, Enterprise Edition), which later became


JEE, a set of specifications extending Java SE with specifications for
enterprise features such as distributed computing and web services.

• J2ME (Java 2 Platform, Micro Edition), which later became JME, a


computing platform for development and deployment of portable
code for embedded and mobile devices.

With this release, the JIT compiler became part of Sun Microsystem’s JVM (which
basically means turning code into executable code became a faster operation and the
generated executable code was optimized), the Swing graphical API was introduced as
a fancy alternative to AWT (new components to create fancy desktop applications were
introduced), and the Java Collections Framework (for working with sets of data) was
introduced.
J2SE 1.3 was released in 2000 with the codename Kestrel (maybe as a reference to
the newly introduced Java sound classes). This release also contained Java XML APIs.
J2SE 1.4 was released in 2002 with the codename Merlin. This is the first year that the
Java Community Process members were involved in deciding which features the release
should contain, and thus the release was quite consistent. This is the first release of the
Java platform developed under the Java Community Process as JSR 59.7 The following
features are among those worth mentioning:

• Support for IPv6: Basically applications that run over a network can
now be written to work using networking protocol IPv6.

6
All codenames, for intermediary releases too, are listed at Oracle, “JDK Releases,” http://www.
oracle.com/technetwork/java/javase/codenames-136090.html, accessed October 15, 2021.
7
If you want to see the contents and the list of Java Specification Requests, see Java Community
Process, http://www.jcp.org/en/jsr/detail?id=59, accessed October 15, 2021.

12
Chapter 1 An Introduction to Java and Its History

• Nonblocking IO: IO is an acronym for input-output, which refers


to reading and writing data—a very slow operation. Making IO
nonblocking means to optimize these operations to increase speed of
the running application.

• Logging API: Operations that get executed need to be reported to a


file or a resource, which can be read in case of failure to determine
the cause and find a solution. This process is called logging and
apparently only in this version components to support this operation
were introduced.

• Image processing API: Components developers can use this to


manipulate images with Java code.

Java’s coffee cup logo made its entrance in 2003 (between releases 1.4 and 5.0) at the
JavaOne conference. You can see it in Figure 1-6.8

Figure 1-6. Java official logo 2003-2006 (image source: https://oracle.com)

J2SE 5.0 was released in 2004 with the codename Tiger. Initially it followed the
typical versioning and was named 1.5, but because this was a major release with a
significant number of new features that proved a serious improvement of maturity,
stability, scalability, and security of the J2SE, the version was labeled 5.0 and presented
like that to the public, even if internally 1.5 was still used. For this version and the next
two, it was considered that 1.x = x.0. Let’s list those features because most of them are
covered in the book:

8
The Java language was first named Oak. It was renamed to Java because of copyright issues.
There are a few theories that you will find regarding the new name. There is one saying that the
JAVA name is actually a collection of the initials of the names being part of the Green team: James
Gosling, Arthur Van Hoff, and Andy Bechtolsheim, and that the logo is inspired by their love
of coffee.

13
Chapter 1 An Introduction to Java and Its History

• Generics provide support for compile-time (static) type safety


for collections and eliminates the need for most type conversions
(which means the type used in a certain context is decided while
the application is running, we have a full section about this in
Chapter 5).

• Annotations, also known as metadata, are used to tag classes and


methods to allow metadata-aware utilities to process them (which
means a component is labeled as something another component
recognizes and does specific operations with it).

• Autoboxing/unboxing refers to the automatic conversion between


primitive types and matching object types (wrappers), also covered
in Chapter 5.

• Enumerations define static final ordered sets of values using the


enum keyword; covered in Chapter 4.

• Varargs provide a shorthand for methods that support an arbitrary


number of parameters of one type. The last parameter of a method is
declared using a type name followed by three dots (e.g., String...),
which implies that any number of arguments of that type can be
provided and are placed into an array; covered in Chapter 3.

• Enhanced for each loop: used to iterate over collections and arrays
too, also covered in Chapter 5.

• Improved semantics for multithreaded Java Programs, covered in


Chapter 7.

• Static imports also covered in Chapter 4.


• Improvements for RMI (not covered in the book), Swing (Chapter 10),
concurrency utilities (Chapter 7), and introduction of Scanner class
(Chapter 11).

Java 5 was the first available for Apple Mac OS X 10.4, and the default version
installed on Apple Mac OS X 10.5. There were a lot of updates9 released for this version
up until 2015, to fix issues related to security and performance. It was a pretty buggy

9
Let’s call them what they actually are: hotfixes.

14
Chapter 1 An Introduction to Java and Its History

release, and it is pretty understandable, since quite a lot of features were developed in
only two years.
In 2006, Java SE 6 was released with a little delay, codename Mustang. Yes, this was
yet another rename, and yes, yet again a serious number of features were implemented
in quite a short period of time. A lot of updates were required afterward to fix the existing
issues. This was the last major Java release released by Sun Microsystems, as Oracle
acquired this company in January 2010. The most important features in this release are
listed next.

• Dramatic performance improvements for the core platform


(applications run faster, need less memory or CPU to execute).

• Improved web service support (optimized components that are


required for development of web applications).

• JDBC 4.0 (optimized components that are required for development


of applications using databases).

• Java Compiler API (from your code you can call components that are
used to compile code).

• Many GUI improvements, such as integration of SwingWorker


in the API, table sorting and filtering, and true Swing double-­
buffering (eliminating the gray-area effect); overall, improvement of
components used to create interfaces for desktop applications.

Shortly after (in Java terms), in December 2008, JavaFX 1.0 SDK was released. JavaFX
is suitable for creating graphical user interfaces for any platform. The initial version was
a scripting language. Until 2008, in Java there were two ways to create a user interface:

• Using AWT (Abstract Window Toolkit) components, which are


rendered and controlled by a native peer component specific to the
underlying operating system; that is why AWT components are also
called heavyweight components.

• Using Swing components, which are called lightweight because


they do not require allocation of native resources in the operating
system’s windowing toolkit. The Swing API is a complimentary
extension of AWT.

15
Chapter 1 An Introduction to Java and Its History

For the first versions, it was never really clear whether JavaFX would actually have a
future and if it would grow up to replace Swing. The management turmoil inside Sun did
not help in defining a clear path for this project either.

Oracle Takes Over


Although Sun Microsystems won a lawsuit against Microsoft in which they agreed to pay
$20 million for not implementing the Java 1.1 standard completely, in 2008 the company
was in such poor shape that negotiations for a merger with IBM and Hewlett-Packard
began. In 2009, Oracle and Sun announced that they agreed on the price: Oracle would
acquire Sun for $9.50 per share in cash, which amounted to a $5.6 billion offer. The
impact was massive. A lot of engineers quit, including James Gosling, the father of Java,
which made a lot of developers question the future of the Java platform.

Java 7
Java SE 7, codename Dolphin, was the first Java version released by Oracle in 2011. It
was the result of an extensive collaboration between Oracle engineers and members
of the worldwide Java communities, such as the OpenJDK Community and the Java
Community Process (JCP). It contained a lot of changes, but a lot fewer than developers
expected. Considering the long period between the releases, the expectations were
pretty high. Project Lambda, which was supposed to allow usage of lambda expressions
in Java (this leads to considerable syntax simplification in certain cases), and Jigsaw
(making JVM and the Java application modular; there is a section in Chapter 3 about
them) were dropped. Both were released in future versions.
The following are the most notable features in Java 7:

• JVM support for dynamic languages with the new invoke dynamic
bytecode (basically, Java code can use code implemented in non-Java
languages such as Python, Ruby, Perl, Javascript, and Groovy).

• Compressed 64-bit pointers (internal optimization of the JVM, so less


memory is consumed)

16
Chapter 1 An Introduction to Java and Its History

• Small language changes grouped under project Coin:

–– strings in switch statements (covered in Chapter 7)

–– automatic resource management in try-statement (covered in


Chapter 5)
–– improved type inference for generics—the diamond <> operator
(covered in Chapter 5)

–– binary integer literals: integer numbers can be represented directly


as binary numbers, using the form 0b (or 0B ) followed by one or
more binary digits (0 or 1) (covered in Chapter 5).

–– multiple exceptions handling improvements (covered in Chapter 5)

• Concurrency improvements

• New I/O library (new classes added to read/write data to/from files,
covered in Chapter 8)

• Timsort algorithm was introduced to sort collections and arrays


of objects instead of merge sort because it has better performance.
Better performance usually means reducing of consumed resources:
memory and/or CPU, or reducing the time needed for execution.

Continuing development on a project with almost none of the original development


team involved must have been a very tough job. That is obvious because of the
161 updates that followed; most of them were needed to fix security issues and
vulnerabilities.
JavaFX 2.0 was released with Java 7. This confirmed that the JavaFX project had a
future with Oracle. As a major change, JavaFX stopped being a scripting language and
became a Java API. This meant that knowledge of the Java language syntax would be
enough to start building user graphical interfaces with it. JavaFX started gaining ground
over Swing because of its hardware-accelerated graphical engine called Prism that did a
better job at rendering.

17
Chapter 1 An Introduction to Java and Its History

 Starting with Java 7, the OpenJDK was born, an open-source reference


implementation of the Java SE Platform Edition. This was an effort from the Java
developers' community to provide a version of the JDK that was not under an
Oracle license, because it was assumed that Oracle will introduce stricter licensing
for the JDK in order to make profit from it.

Java 8
Java SE 8, codename Spider, was released in 2014, and included features that were
initially intended to be part of Java 7. Better late than never, right? Three years in the
making, Java 8 contained the following key features:

• Language syntax changes

–– Language-level support for lambda expressions (functional


programming features)

–– Support for default methods in interfaces (covered in Chapter 4)

–– New date and time API (covered in Chapter 5)

–– New way to do parallel processing by using streams (covered in


Chapter 8)

• Improved integration with JavaScript (the Nashorn project).


JavaScript is a web scripting language that is quite loved in the
development community, so providing support for it in Java probably
won Oracle a few new supporters.

• Improvements of the garbage collection process

Starting with Java 8, codenames were dropped to avoid any trademark-law hassles;
instead, a semantic versioning that easily distinguishes major, minor, and security-­
update releases was adopted.10 The version number matches the following pattern:
$MAJOR.$MINOR.$SECURITY.

Open JDK, “JEP 223: New Version-String Scheme,” http://openjdk.java.net/jeps/223,


10

accessed October 15, 2021.

18
Chapter 1 An Introduction to Java and Its History

When executing java -version in a terminal (if you have Java 8 installed), you see a
log similar to the one in Listing 1-3.

Listing 1-3. Java 8 Log for Execution of java -version

$ java -version
java version "1.8.0_162"
JavaTM SE Runtime Environment build 1.8.0_162-b12
Java HotSpotTM 64-Bit Server VM build 25.162-b12, mixed mode

In this log, the version numbers have the following meaning:

• The 1 represents the major version number, incremented for a major


release that contains significant new features as specified in a new
edition of the Java SE Platform Specification.

• The 8 represents the minor version number, incremented for a minor


update release that may contain compatible bug fixes, revisions to
standard APIs, and other small features.

• The 0 represents the security level that is incremented for a security-­


update release that contains critical fixes, including those necessary
to improve security. $SECURITY is not reset to zero when $MINOR
is incremented, which lets the users know that this version is a more
secure one.

• 162 is the build number.

• b12 represents additional build information.

This versioning style is quite common for Java applications, so this versioning style
was adopted to align with the general industry practices.

Java 9
Java SE 9 was released in September 2017. The long-awaited Jigsaw project was finally
here. The Java platform was finally modular.

19
Chapter 1 An Introduction to Java and Its History

 This is a big change for the Java world; it’s not a change in syntax and it’s not
some new feature. It’s a change in the design of the platform. Some experienced
developers I know who have used Java since its first years have had difficulties
adapting. It is supposed to fix some serious problems that Java has been living
with for years (covered in Chapter 3). You are lucky because as a beginner, you
start from scratch, so you do not need to change the way you develop your
applications.

The following are the most important features, aside from the introduction of Java
modules:

• The Java Shell tool, an interactive command-line interface for


evaluation declarations, statements, and expressions written in Java
(covered in Chapter 3)

• Quite a few security updates

• private methods are now supported in interfaces (covered in


Chapter 4)

• Improved try-with-resources: final variables can now be used as


resources (covered in Chapter 5)
• “_” is removed from the set of legal identifier names (covered in
Chapter 4)

• Enhancements for the Garbage-First (G1) garbage collector; this


becomes the default garbage collector (covered in Chapter 13)

• Internally, a new more compact String representation is used


(covered in Chapter 5)

• Concurrency updates (related to parallel execution, mentioned in


Chapter 5)

• Factory methods for collections (covered in Chapter 5)

• Updates of the image processing API optimization of components


used to write code that processes images

20
Chapter 1 An Introduction to Java and Its History

Java 9 followed the same versioning scheme as Java 8, with a small change. The Java
version number contained in the name of the JDK finally became the $MAJOR number in
the version scheme. So if you have Java 9 installed, when executing java -version in a
terminal, you see something similar to the log in Listing 1-4.

Listing 1-4. Java 9 Log for Execution of java -version

$ java -version
java version "9.0.4"
JavaTM SE Runtime Environment build 9.0.4+11
Java HotSpotTM 64-Bit Server VM build 9.0.4+11, mixed mode

Java 10
Java SE 10 (AKA Java 18.3) was released on March 20, 2018. Oracle changed the Java
release style so that a new version is released every six months. Java 10 also uses the new
versioning convention set up by Oracle: the version numbers follow a $YEAR.$MONTH
format.11 This release versioning style is supposed to make it easier for developers and
end users to figure out the age of a release, so that they can judge whether to upgrade it
to a newer release with the latest security fixes and additional features.
The following are a few features of Java 10.12
• A local-variable type inference to enhance the language to extend
type inference to local variables (this is the most expected feature and
is covered in Chapter 5)

• More optimizations for garbage collection (covered in Chapter 13)

• Application Class-Data Sharing to reduce the footprint by sharing


common class metadata across processes (this is an advanced feature
and it won’t be covered in the book)

11
Conventions described by Open JDK, “JEP 322: Time-Based Release Versioning,” http://
openjdk.java.net/jeps/322, accessed October 15, 2021.
12
The complete list can be found at Open JDK, “JDK 10,” http://openjdk.java.net/projects/
jdk/10, accessed October 15, 2021, and the release notes containing the detailed list with API
and internal changes can be found at Oracle, “JDK 10 Release Notes,” https://www.oracle.com/
java/technologies/javase/10-relnote-issues.html, accessed October 15, 2021.

21
Chapter 1 An Introduction to Java and Its History

• More concurrency updates (related to parallel execution, mentioned


in Chapter 5)

• Heap allocation on alternative memory devices (The memory


needed by JVM to run a Java program—called heap memory—can
be allocated on an alternative memory device, so the heap can also
be split between volatile and nonvolatile RAM. More about memory
used by Java applications can be read in Chapter 5.)

When JDK 10 is installed, running java -version in a terminal shows a log that is
similar to the one in Listing 1-5.

Listing 1-5. Java 10 Log for Execution of java -version

$ java -version
java version "10" 2018-03-20
JavaTM SE Runtime Environment 18.3 build 10+46
Java HotSpotTM 64-Bit Server VM 18.3 build 10+46, mixed mode

Java 11
Java SE 11 (AKA Java 18.9),13 released on September 25, 2018, contains the following
features:

• Removal of JEE advanced components used to build enterprise Java


applications and Corba (very old technology for remote invocation,
allowing your application to communicate with applications installed
on a different computer) modules.

• Local-variable syntax for lambda parameters allow the var keyword


to be used when declaring the formal parameters of implicitly typed
lambda expressions.

• Epsilon, a low-overhead garbage collector (a no-GC, so basically you


can run an application without a GC), basically more optimizations
to the garbage collection (covered in Chapter 13).

The full list of features is at Open JDK, “JDK 11,” http://openjdk.java.net/projects/jdk/11/,


13

accessed October 15, 2021.

22
Chapter 1 An Introduction to Java and Its History

• More concurrency updates (related to parallel execution, mentioned


in Chapter 5).

• The Nashorn JavaScript script engine and APIs are marked as


deprecated with the intent to remove them in a future release.
ECMAScript language constructs evolve pretty rapidly, so Nashorn
was getting difficult to maintain.

Aside from these changes, it was also speculated that a new versioning change
should be introduced because the $YEAR.$MONTH format did not go so well with
developers. (Why so many versioning naming changes? Is this really so important?
Apparently, it is.) The proposed versioning change is similar to the one introduced in
Java 9.14
When JDK 11 is installed, running java -version in a terminal shows a log that is
similar to the one in Listing 1-6.

Listing 1-6. Java 11 Log for Execution of java -version

$ java -version
java version "11.0.3" 2019-04-16 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.3+12-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.3+12-LTS, mixed mode)

JDK 11 is a long-term support release with several years of support planned. This is
what the LTS in the version name means.
Concomitant with the release of JDK 11, Oracle announced that they would start
charging for Java SE 8 licenses, so small businesses that try to reduce their software costs
started looking for alternatives. AdoptOpenJDK provides prebuilt OpenJDK binaries
from a fully open-source set of build scripts and infrastructure, for multiple platforms.
OpenJDK has the same code as OracleJDK, depending on what provider you’re using.
Another advantage is that while the Oracle, JDK cannot be modified to suit the needs
of a business application; OpenJDK can be modified because is licensed under GNU
General Public License, which is quite permissive.
Also, if money is not an issue Amazon’s Coretto, Azul Zulu, and GraalVM are all
alternate JDKs optimized in one way or another.

If you are curious, you can read a detailed specification for it at Open JDK, “Time-Based Release
14

Versioning.”

23
Chapter 1 An Introduction to Java and Its History

Java 12
Java SE 12,15 released on March 29, 2019, contains the following important features:

• A new experimental Garbage Collector (GC) algorithm named


Shenandoah that reduces GC pause times.

• Modified syntax for the switch statement, allowing it to be used as


an expression as well. It also removes the need for break statements
(covered in Chapter 7).

• JVM Constants API, to model nominal descriptions of key class-­


file and run-time artifacts. This API can be helpful for tools that
manipulate classes and methods.

• Minor improvements to the G1 garbage collector (covered in


Chapter 13).

• CDS archives to improve the JDK build process.

• Approximately 100 microbenchmarks16 are added to the JDK source.


When JDK 12 is installed, running java -version in a terminal shows a log that is
similar to the one in Listing 1-7.

Listing 1-7. Java 12 Log for Execution of java -version

$ java -version
java version "12.0.2" 2019-07-16
Java(TM) SE Runtime Environment (build 12.0.2+10)
Java HotSpot(TM) 64-Bit Server VM (build 12.0.2+10, mixed mode, sharing)

JDK 12 is part of Oracle’s six-month release cadence introduced with JDK 9 in


September 2017. JDK 12 is a feature release with a short support lifespan. Two patches
have been already released for this version.

15
The full list of features is at Open JDK, “JDK 12,” http://openjdk.java.net/projects/jdk/12/,
accessed October 15, 2021.
16
Based on Java Microbenchmark Harness, Open JDK, “Code Tools: jmh,” https://openjdk.
java.net/projects/code-tools/jmh/, accessed October 15, 2021.

24
Chapter 1 An Introduction to Java and Its History

Java 13
Java SE 13,17 released on September 17, 2019, contains a few important features,
hundreds of smaller enhancements, and thousands of bug fixes. The most important
features of this version are:

• Dynamic CSD archives (an improvement of the CDS archive support


added in JDK 12)

• Z Garbage Collector enhancements (covered in Chapter 13)

• A new implementation of the Legacy Socket API

• More improvements for the switch expressions (covered in


Chapter 7)

• Support for text blocks (covered in Chapter 5)

When JDK 13 is installed, running java -version in a terminal shows a log that is
similar to the one in Listing 1-8.

Listing 1-8. Java 13 Log for Execution of java -version

$ java -version
java version "13.0.2" 2020-01-14
Java(TM) SE Runtime Environment (build 13.0.2+8)
Java HotSpot(TM) 64-Bit Server VM (build 13.0.2+8, mixed mode, sharing)

JDK 13 is a feature release with a short support lifespan as well. Two patches have
been already released for this version.

Java 14
Java SE 14,18 released on March 17, 2020, contains a big list of important features,
enhancements, and bug fixes. The most important features of this version are:

17
The full list of features is at Open JDK, “JDK 13,” http://openjdk.java.net/projects/jdk/13/,
accessed October 15, 2021.
18
The full list of features is at Open JDK, “JDK 14,” http://openjdk.java.net/projects/jdk/14/,
accessed October 15, 2021.

25
Chapter 1 An Introduction to Java and Its History

• Pattern matching for the instanceof operator (covered in Chapter 7)

• JFR Event Streaming API for collecting profiling and diagnostic data
about a Java application and the JVM as they’re running

• More enhancements of the G1 garbage collector (covered in


Chapter 13)

• The CMS (Concurrent Mark Sweep) garbage collector was removed.

• Support for the Z Garbage Collector for macOS (covered in


Chapter 13)

• Records were introduced to provide a compact syntax for declaring


classes that are transparent holders for shallowly immutable data
(covered in Chapter 5)

• Foreign Memory Access API provides support for Java programs to


safely and efficiently access foreign memory outside of the Java heap

• Improvements of the NullPointerException class to provide more


precise details to easily identify the variable being null

• The jpackage tool was introduced to provides support for native


packaging formats to give end users a natural installation experience

When JDK 14 is installed, running java -version in a terminal shows a log that is
similar to the one in Listing 1-9.

Listing 1-9. Java 14 Log for Execution of java -version

$ java -version
java version "14.0.2" 2020-07-14
Java(TM) SE Runtime Environment (build 14.0.2+12-46)
Java HotSpot(TM) 64-Bit Server VM (build 14.0.2+12-46, mixed mode, sharing)

Even if this release contains a lot of new features, most of them are available only
in preview mode or are considered being in the incubation phase, making this release
unstable and not a candidate for long-term support.

26
Chapter 1 An Introduction to Java and Its History

Java 15
Java SE 15,19 released on September 15, 2020, contains considerable improvements to
projects added in previous versions. The most notable features of this version are:

• Removal of the Nashorn JavaScript Engine

• Addition of sealed and hidden classes (covered in Chapter 4)

• The Edwards-Curve Digital Signature Algorithm (EdDSA) is now


supported for cryptographic signatures

• More enhancements for the Legacy DatagramSocket API

• Biased Locking was disabled and deprecated, which leads to


performance increase for multithreaded applications

When JDK 15 is installed, running java -version in a terminal shows a log that is
similar to the one in Listing 1-10.

Listing 1-10. Java 15 Log for Execution of java -version

$ java -version
java version "15" 2020-09-15
Java(TM) SE Runtime Environment (build 15+36-1562)
Java HotSpot(TM) 64-Bit Server VM (build 15+36-1562, mixed mode, sharing)

JDK 15 is just a short-term release that was supported with Oracle Premier Support
for six months until JDK 16 arrived in March 2021.

Java 16
Java SE 16,20 released on March 16, 2021, is the reference implementation of the version
of standard Java set to follow JDK 15. This means that everything unstable in JDK 15 is
expected to be more stable in JDK 16. Aside from that, the most notable features of this
version are:

19
The full list of features is at Open JDK, “JDK 15,” http://openjdk.java.net/projects/jdk/15/,
accessed October 15, 2021.
20
The full list of features is at Open JDK, “JDK 16,” http://openjdk.java.net/projects/jdk/16/,
accessed October 15, 2021.

27
Chapter 1 An Introduction to Java and Its History

• Introduction of a Vector API, to express vector computations that


compile to optimal vector hardware instructions on supported CPU
architectures, to achieve superior performance to equivalent scalar
computations

• Strong encapsulation of JDK internals by default (covered in


Chapter 3)

• Foreign linker API is introduced to provide statically typed, pure-Java


access to native code

• Introduction of an Elastic Metaspace which promotes return of


unused HotSpot class-metadata (i.e., metaspace) memory to the
operating system more promptly

• Added support for C++ 14 language features

When JDK 16 is installed, running java -version in a terminal shows a log that is
similar to the one in Listing 1-11.

Listing 1-11. Java 16 Log for Execution of java -version

$ java -version
openjdk version "16-ea" 2021-03-16
OpenJDK Runtime Environment (build 16-ea+30-2130)
OpenJDK 64-Bit Server VM (build 16-ea+30-2130, mixed mode, sharing)

JDK 16 is just a short-term release that was supported with Oracle Premier Support
for six months until JDK 17 arrived in September 2021. At the time this chapter was being
written, JDK 16 was available only via the early access program, which is why the “ea”
string is present in the version name.

Java 17
JDK 17,21 the next long-term support release, will be supported by Oracle for eight years.
It was released on September 14, 2021, as per Oracle’s six-month release cadence for
Java SE versions.

The full list of features is at JDK.java.net, “JDK 17 General-Availability Release,” https://jdk.


21

java.net/17, accessed October 15, 2021.

28
Chapter 1 An Introduction to Java and Its History

When this chapter was being written, JDK 17 was available only via the early access
program, which is why the “ea” string is present in the version name; it means early
access. It is quite difficult to use, as it is not supported by any editors or other build tools
yet. The list of features is also incomplete and proposals for bug fixes and features are
still welcome from the Java community.
By the time this book is released, Java 17 will be stable and ready to use. The book
will fully cover all the important stable features of this release. Preview features are not
included because they represent a risk for the stability of this project.

• Performance and implementation improvements for the Vector API


introduced in JDK 16

• Refinements for sealed classes and interfaces

• Introducing Pattern Matching for switch expressions (feature


preview)

• macOS specific improvements

• Enhancements for Pseudo-Random Number Generators:


introduction of new interface and implementations for
pseudorandom number generators (PRNGs), which including
jumpable PRNGs and a new class of splittable PRNG
algorithms (LXM)

• Enhancements on encapsulating JDK internals

• Deprecate the Applet API (prepare for removal in JDK 18)

• Deprecate the Security Manager (prepare for removal in JDK 18)

• Foreign Function & Memory API merges two previously incubating


APIs the Foreign-Memory Access API and the Foreign Linker API, to
allow developers to call up native libraries and process native data
without the risks of JNI

The list of features for JDK 17 are focused on the JVM internals to improve
performance and deprecate/discard old APIs.
When JDK 17 is installed, running java -version in a terminal shows a log that is
similar to the one in Listing 1-12.

29
Chapter 1 An Introduction to Java and Its History

Listing 1-12. Java 17 Log for Execution of java -version

openjdk version "17" 2021-09-14


OpenJDK Runtime Environment (build 17+35-2724)
OpenJDK 64-Bit Server VM (build 17+35-2724, mixed mode, sharing)

This is where the details end. If you want more information on the first 25 years, you
can easily find it on the Internet.22

Prerequisites
Before ending this chapter, it is only fair to tell you that to learn Java, you need a
few things:

• Know your way around an operating system, such as Windows,


Linux, or macOS.

• How to refine your search criteria, because information related to


your operating systems is not covered in the book; if you have issues,
you must fix them yourself.

• An Internet connection.

If you already know Java, and you bought this book out of curiosity or for the
modules chapter, knowing about a build tool like Maven or Gradle is helpful, because
the source code is organized in a multimodule project that can be fully built with one
simple command. I’ve chosen to use a build tool because in this day and age, learning
Java without one makes no sense; any company you apply to most definitely uses one.
Aside from the prerequisites that I listed, you also need install a JDK and a Java
Editor. This is covered in Chapter 2. You do not need to know math, algorithms, or
design patterns (though you might end up knowing a few after you read this book).
This being said, let’s dig in.

You can start your reading here, if you consider it necessary: Free Java Guide, “History of Java
22

Programming Language,” https://www.freejavaguide.com/history.html, accessed October


15, 2021.

30
Chapter 1 An Introduction to Java and Its History

Summary
Java has dominated the industry for more than 25 years. It wasn’t always at the top of the
most-used development technologies, but it has never left the top five either. Even with
server-side JavaScript smart frameworks like Node.js, the heavy-lifting is still left to Java.
Emerging programming languages like Scala and Kotlin run on the JVM, so maybe the
Java programming language will suffer a serious metamorphosis in order to compete,
but it will still be here.
The modularization capability introduced in version 9 opens the gates for Java
applications to be installed on smaller devices, because to run a Java application, we
no longer need the whole runtime—only its core plus the modules the application was
built with.
Also, there are a lot of applications written in Java, especially in the financial domain,
so Java will still be here because of legacy reasons and because migrating these titan
applications to another technology is an impossible mission. Most of these applications
are stuck on JDK 8, however, because they are complex and have a lot of dependencies
that require upgrading too, which is not always possible.
Java will probably survive and be on top for the next 10 to 15 years. It does help that
it is a very mature technology with a huge community built around it. Being very easy
to learn and developer-friendly makes it remain the first choice for most companies.
So you might conclude at this point that learning Java and buying this book is a good
investment.
This chapter has a lot of references. They are an interesting read, but they are not
mandatory to understand the contents of this book. The same goes for the rest of the
chapters.

31

You might also like