JShell guide - tab completion

created onJanuary 28, 2022

Tab completion works for commands, command parameters, variables, methods, classes and interfaces.

tab completion for variables

Press tab once for completion, twice to show information about a variable (class name, documentation)

jshell> whatever Signatures: whatever:java.lang.String <press tab again to see documentation> jshell>

tab completion for methods

Tab completion lists available methods that start with the part of the method that has been entered, i.e. “whatever”.st results in:

jshell> "whatever".st startsWith( strip() stripLeading() stripTrailing()

At a method call’s open-parenthesis, tab will list the completions with parameter types as below:

jshell> "whatever".startsWith( whatever Signatures: boolean String.startsWith(String prefix, int toffset) boolean String.startsWith(String prefix) <press tab again to see documentation> jshell> "whatever".startsWith(

tab completion for packages, classes and interfaces

Tab completion for packages is a handy tool to list the content of a package. Hitting again after the package name has been expanded after a previous hit shows the package content. Tab completion for classes and interfaces can be used to show the documentation for a class or an interface.

tab completion for files

Tab completion works for files, i.e. files that you want to load with the command .