25 Introduction to JShell: Java 9’s REPL for Interactive Java

Objectives

In this chapter you’ll:

  • See how using JShell can enhance the learning and software development processes by enabling you to explore, discover and experiment with Java language and API features.

  • 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. ...

Get Java How To Program, Late Objects, 11th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.