Paul Deitel
Paul Deitel

Paul Deitel, CEO of Deitel & Associates, Inc., co-author of Java® 9 for Programmers, and an Oracle Java Champion, will lead a live online introduction to JShell for interactive Java®.

Deitel’s two-day, three-hours-per-day, live online training will be presented exclusively through Safari, O’Reilly’s learning platform.

JShell can enhance your learning and software development processes by enabling you to interactively explore, discover, and experiment with Java 9 language and API features.

What you’ll learn in Interactive Java with Java 9’s JShell

In this live online training, you’ll:

  • Start a JShell session.
  • Execute code snippets.
  • Declare variables explicitly.
  • Evaluate expressions.
  • Edit existing code snippets.
  • Declare and use a class.
  • Save snippets to a file.
  • Open a file of JShell snippets and evaluate them.
  • Auto-complete code and JShell commands.
  • Display method parameters and overloads.
  • Discover and explore with the Java API documentation in JShell.
  • Declare and use methods.
  • Forward reference a method that has not yet been declared.
  • See how JShell wraps exceptions.
  • Import custom packages/modules for use in a JShell session.
  • Control JShell’s feedback level.
  • Solve dozens of JShell exercises and review their answers.
  • See a list of additional JShell resources.
  • And more.

Visit Safari for the detailed course outline and prerequisites for Interactive Java with Java 9’s JShell.

How JShell will make developers’ lives easier

JShell is one of Java’s most significant new learning, discovery, and developer-productivity-enhancement features since its inception 20+ years ago. The Java community—by far the largest programming-language community in the world—has grown to more than 10 million developers. But along the way, not much has been done to improve the learning and discovery processes for new and experienced developers. That changes dramatically in Java 9 with the introduction of JShell—Java’s REPL (read-evaluate-print loop).

What is JShell?

What’s the magic? It’s simple. JShell provides a fast and friendly environment that enables you to interactively explore, discover, and experiment with Java language features and its extensive libraries.

JShell’s REPL replaces the tedious cycle of editing, compiling, and executing in traditional Java development. Rather than complete programs, you write JShell commands and Java code snippets. When you enter a snippet, JShell immediately reads it, evaluates it, and prints the results that help you see the effects of your code. Then it loops to perform this process again for the next snippet. In this hands-on course, you’ll work through scores of examples and exercises, and see how JShell and its instant feedback keep your attention, enhance your productivity, and speed the learning and software-development processes. JShell is especially valuable for rapidly prototyping small code segments.

Code comes alive

Paul Deitel’s books, videos, and training courses emphasize the value of live code, focusing on complete, working programs. JShell brings this right down to the individual snippet level. Your code literally comes alive as you enter each snippet. Of course, you’ll still make occasional errors. JShell reports compilation errors to you on a snippet-by-snippet basis and logic errors can immediately become apparent.

Kinds of snippets

Snippets can be expressions, individual statements, multi-line statements, and larger entities, like methods and classes. JShell supports all but a few Java features, but there are some differences designed to facilitate JShell’s explore-discover-and-experiment capabilities. In JShell, expressions and statements do not need to be in methods, methods do not need to be in classes, and you do not need a main. Eliminating this infrastructure saves you considerable time.

Discovery with auto-completion

The course includes a detailed treatment of auto-completion—a key discovery feature that speeds the coding process. After you type a portion of a name (class, method, variable, etc.) and press the Tab key, JShell completes the name for you or provides a list of all possible names that begin with what you’ve typed so far. You can then easily display method parameters and even the documentation that describes those methods.

Rapid prototyping

Professional developers will commonly use JShell for rapid prototyping. Once you develop and test a small chunk of code, you can paste it into your larger project.

About O'Reilly's live online training

Since launching live online training courses in December, 2016, O'Reilly has trained over 14,000 people in more than 150 courses, including Docker: Up and Running, Designing for Voice: Conversational UI, Python: Beyond the Basics, High-Performance TensorFlow in Production, and Design Thinking: Practice and Measurement Essentials.

Article image: Paul Deitel