Friday 8 January 2021

jshell: /types: List type declarations

‘/types’ command is used to list the type declarations.

 

Step 1: Open terminal and execute the command jshell.

$jshell
|  Welcome to JShell -- Version 10.0.2
|  For an introduction type: /help intro

jshell>

 

Step 2: Define Employee class by executing below snippet.

public class Employee {
	public int id;
	public String firstName;
	public String lastName;

}

 

jshell> public class Employee {
   ...>     public int id;
   ...>     public String firstName;
   ...>     public String lastName;
   ...> 
   ...> }
|  created class Employee

 

Step 3: Execute the command /types to see list of types defined in jshell session.

jshell> /types
|    class Employee

 

 

 

 

 

 

 

Previous                                                    Next                                                    Home

No comments:

Post a Comment