
- Java Tutorial
- Java - Home
- Java - Overview
- Java - Environment Setup
- Java - Basic Syntax
- Java - Object & Classes
- Java - Constructors
- Java - Basic Datatypes
- Java - Variable Types
- Java - Modifier Types
- Java - Basic Operators
- Java - Loop Control
- Java - Decision Making
- Java - Numbers
- Java - Characters
- Java - Strings
- Java - Arrays
- Java - Date & Time
- Java - Regular Expressions
- Java - Methods
- Java - Files and I/O
- Java - Exceptions
- Java - Inner classes
- Java Object Oriented
- Java - Inheritance
- Java - Overriding
- Java - Polymorphism
- Java - Abstraction
- Java - Encapsulation
- Java - Interfaces
- Java - Packages
- Java Advanced
- Java - Data Structures
- Java - Collections
- Java - Generics
- Java - Serialization
- Java - Networking
- Java - Sending Email
- Java - Multithreading
- Java - Applet Basics
- Java - Documentation
- Java Useful Resources
- Java - Questions and Answers
- Java - Quick Guide
- Java - Useful Resources
- Java - Discussion
- Java - Examples
How to list all the classes, interfaces, and enums in JShell in Java 9?
The JShell tool also called REPL(Read-Evaluate-Print-Loop) introduced in Java 9 that allows us to execute Java code and getting immediate results. We can quickly evaluate expressions or short algorithms without creating a new project, compile or build it. With the help of JShell, we can execute expressions, use imports, define classes, methods, and variables.
We can list out all the classes, interfaces and enums defined in the current JShell session by using "/types" command.
In the below code snippet, we have created the "Test" class, "TestInterface" interface, and enum "EnumTest" in the JShell tool.
C:\Users\User> jshell | Welcome to JShell -- Version 9.0.4 | For an introduction type: /help intro jshell> class Test { ...> public static void main(String args[]) { ...> System.out.println("TutorialsPoint"); ...> } ...> } | created class Test jshell> interface TestInterface { ...> public void sum(); ...> } | created interface TestInterface jshell> enum EnumTest { ...> TUTORIALSPOINT, ...> TUTORIX ...> } | created enum EnumTest
In the below code snippet, list out all the classes, interfaces, and enums by using "/types" command.
jshell> /types | class Test | interface TestInterface | enum EnumTest jshell>
- Related Articles
- How to display different list commands in JShell in Java 9?
- How to use enums in Python classes?
- How to debug JShell in Java 9?
- How to reset the JShell session in Java 9?
- JShell in Java 9?
- How to get the date and time in JShell in Java 9?
- How to get JShell documentation in Java 9?
- What is the difference between interfaces and abstract classes in Java?
- How to save the current JShell session in Java 9?
- How to implement the encapsulation concept in JShell in Java 9?
- How to implement the Fibonacci series in JShell in Java 9?
- How to create a class and object in JShell in Java 9?
- How to define expressions, variables, and methods in JShell in Java 9?
- How to implement relational and logical operators in JShell in Java 9?
- How to implement String utility and immutability in JShell in Java 9?

Advertisements