New to the seventh edition

It has been quite some time since this book last saw an update. When the 6th edition was pub-lished in 2017, Java 8 was the most recent Java version and using functional constructs (such as lambdas or streams) in Java was still seen as something of a novelty.

Much has changed in the world of Java since then. The current version at the time of writing is Java 22, once-new constructs have become mainstream, and additional new language mechanisms have been added in turn.

While this book has been thoroughly updated to include all recent Java language additions, chang-es to the language are not the only improvements to the book. The most obvious change since the last edition is the addition of four entirely new chapters.

Chapter 10 now introduces teamwork. In our own teaching with this book, teamwork has always been a central element. We make our students work in pairs and in groups, working on program-ming assignments collaboratively and concurrently. This book, after all, has always had a clear fo-cus on software engineering, and software development is a team sport.

The book now introduces the concepts and technologies to support teams more formally. This is, as always, supported by BlueJ, which is fully integrated with GIT, a distributed source repository system. In chapter 10, students will learn to work with source code repositories and GIT, giving them important tools for their progression to more professional practices. And even if you—the reader—intend to work on your own, knowing and using GIT has important advantages that will make you a better software developer.

In Chapter 11, recursion has now received its own place of discussion. Recursion has always been an important part of the toolbox of a good programmer, and some of the most famous algorithms in computer science rely on it. Recursive approaches have been missing from earlier editions of our book, and we have now filled this gap. As always, we have strived to use a practical pro-gramming project that exhibits the new constructs naturally and provides an interesting example.

Chapter 15 is a new chapter motivated by a recent addition to the Java language: records. The rec-ord construct allows the writing of a specific type of class—one that serves mostly as a straight-forward data representation—and this represents not just a new language construct, but an interest-ing concept and a way of thinking about modelling our programs. Thus, discussion in a separate chapter is appropriate.

Finally, Chapter 16 presents a brief history of the Java language. For people who are interested in the history of programming, this chapter provides the story and background of how we got to where we are with the current Java version.

But presenting the history, for us, has another important goal, beyond the interest in history for its own sake. In understanding how the Java language developed over time, we can gain an under-standing not only of what Java is, but why it is the way it is.

This question of why is important to us. It is important that the reader, at the end of studying this book, not only knows Java, but has developed a general understanding of programming and pro-gramming languages. As teachers, we have to recognise that most of our students, for most of their future careers, will not program in Java, but in a programming language that probably has not been developed yet. To start our students off on their path to becoming competent and pas-sionate programmers, it is important not only to understand the what of a programming language, but the why. Presenting how languages change over time is one fascinating way to have this dis-cussion.

A side effect of presenting the history of Java is that this chapter also gives us an opportunity to mention language constructs that we are not using in this book (often because they have become obsolete when they were replaced by newer constructs). It is useful for readers to be aware of the existence of these constructs, since they may encounter them in code being maintained, even if we do not intend to use them in our own implementations.

In addition to these new chapters, other changes in this edition appear throughout the entire text:

  • We have updated the syntax of the Java code throughout to use constructs introduced in recent Java versions. This includes use of records, the new-syntax switch statements, switch expres-sions and pattern matching switch, several new library methods, and more.
  • The GUI toolkit used in this book is now JavaFX. JavaFX allows us to develop more modern looking interfaces than the Swing toolkit used previously. It also has some better technology support, such as using separate style sheets and the optional use of an external GUI builder.
  • Functional language constructs, such as lambdas and streams, are no longer treated as advanced material, but have been integrated throughout this book, with some new examples added in several chapters.

Despite these changes, the overall structure, tone, and approach of the book is unchanged; it has worked very well in the past, and there is no reason to deviate from it.

Back to main page