If you’re a recruiter in the tech space, you’ve no doubt heard about Java. Here’s a little bit about the programming language, including why it’s so popular, and the latest developments in its evolution.
Having celebrated its 23rd anniversary in May, Java is a curious beast. Way back when the programming language started, the web was in its infancy; and as websites burgeoned in popularity, so did Java’s usage. Developers really liked a class-based, object-oriented language that seemed especially effective for client-server web applications (and, later, native apps for the Android mobile operating system).
The language is also constantly updated: Java SE 10 was released in March 2018, effectively making its predecessor (Java SE 9) obsolete.
If you’re more familiar with the language—you’re a hiring manager who once coded, for instance—here are some things to know about the latest version of the language. First, it includes some very long-awaited features such as the addition of keyword ‘var’ for declaring variables without explicitly declaring the type—a mere 11 years after C# did the same. Keyword var reduces the verbosity of Java with a lot less boilerplate code. For instance:
List list = new LinkedList<>();
var list = new LinkedList<>();
You can’t just declare a variable with var xyz; the declaration has to have an initial value so the compiler can determine the type. This means your code looks neater, like this:
var letters = List.of(“a”, “b”, “c”); for (var ch : letters) System.out.print(ch + “, “);
It’s not quite as powerful as in C#; for instance, you’ll have to wait until a future version for var working with Lambda expression parameters. That being said, it is still a significant improvement that increases the readability of programs. I’ve seen variable declarations where the type name alone is 60 characters or longer; given the impact of var in C#, it’ll probably prove even more effective in Java in reducing this kind of ungainliness.
Other new features in Java 10 include improvements to the Garbage Collector, refined thread callbacks, an experimental JIT compiler, and more. You can read all about them in the release notes. Let’s look closer at unmodifiable collections, which may confound some people new to Java.
Extra Unmodifiable Collections
In programming, you should be careful to distinguish between unmodifiable and immutable: Immutable collections can’t be changed at all, and have been included since Java 9. An unmodifiable collection is one that does not support any modifications at all, so there are no methods such as add, remove or clear.
In addition, an unmodified collection is usually a read-only wrapper of an existing collection. You can’t modify the collection through that reference, but another reference may allow it. (However, the immutable collection can’t ever change.)
Here’s an example:
Collection myList = new ArrayList(); myList.add(“Hi!”); Collection unModList = Collections.unmodifiableList(myList); Set immutableSet = Set.of(“alpha”, “beta”, “gamma”, “omega”);
Here, myList is mutable, as the myList.add(“Hi!”); shows. The unmodList uses the unmodifiableList method. You can still modify myList directly, but not through unModList. The immutableSet is shown for comparison; it cannot be altered.
New Release Cycle
Java 10 is the open-source reference implementation of the Java SE 10 platform. It’s the first of Oracle’s new six-month release cycles. A new Java Development Kit (JDK) will be released every six months, and a long-term support version (LTS) every three years, as with Ubuntu, Fedora and Red Hat Linux releases.
This Java 10 release was originally planned for September 2018, but at some point was switched to March 20, 2018. (It’s a new world when software gets delivered early!) You can get a feel for what’s coming in future releases on the OpenJDK site. The next release, JDK 11, currently lists four JDK Enhancement Proposals (JEPS), with all proposals listed here.
What of the Enterprise?
Previously known as J2EE, Java EE has been largely abandoned by Oracle, which moved it to an open-source foundation (the Eclipse Foundation) in mid-2017. Personally, I find this baffling because enterprise is where the big bucks are; if you want to get into enterprise development, you should familiarize yourself with Java EE.
Java seems to have gone in two directions. One is in mobile development; for example, you can use it to program Android applications (in addition to Kotlin). Within the enterprise, Java EE is used extensively, although a variety of other languages (including Python, C#, and even VB.NET) are battling it for dominance in the desktop-development space.
Nearly four years ago, the ACM published an article that showed Python with the edge over Java as the language used to teach introductory-programming courses. But the latter is still the number-one programming language in large businesses, meaning it’s important for recruiters and hiring managers to know!