Book Image

Java 9 with JShell

By : Gaston C. Hillar
Book Image

Java 9 with JShell

By: Gaston C. Hillar

Overview of this book

The release of Java 9 has brought many subtle and not-so-subtle changes to the way in which Java programmers approach their code. The most important ones are definitely the availability of a REPL, known as JShell, which will make experiments and prototyping much more straightforward than the old IDE-based project-led approach. Another, more subtle change can be seen in the module system, which will lead to more modularized, maintainable code. The techniques to take full advantage of object-oriented code, functional programming and the new modularity features in Java 9 form the main subjects of this book. Each chapter will add to the full picture of Java 9 programming starting out with classes and instances and ending with generics and modularity in Java.
Table of Contents (23 chapters)
Java 9 with JShell
Credits
About the Author
Acknowledgement
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface
Index

Chapter 1. JShell – A Read-Evaluate-Print-Loop for Java 9

In this chapter, we will start our journey toward object-oriented programming with Java 9. You will learn how to launch and work with a new utility introduced with Java 9 that will allow us to easily run Java 9 code snippets and print their results: JShell. This utility will make it easy for you to learn object-oriented programming. We will do the following:

  • Get ready for our journey toward OOP (Object-Oriented Programming) with Java 9

  • Install the required software on Windows, macOS, or Linux

  • Understand the benefits of working with a REPL (Read-Evaluate-Print-Loop) utility

  • Check default imports and use auto-complete features

  • Run Java 9 code in JShell

  • Evaluate expressions

  • Work with variables, methods, and sources

  • Edit the source code in our favorite external code editor

  • Load source code