Java Language JShell Variables

30% OFF - 9th Anniversary discount on Entity Framework Extensions until December 15 with code: ZZZANNIVERSARY9

Example

You can declare local variables within JShell:

jshell> String s = "hi"
jshell> int i = s.length

Keep in mind that variables can be redeclared with different types; this is perfectly valid in JShell:

jshell> String var = "hi"
jshell> int var = 3

To see a list of variables, enter /vars at the JShell prompt.



Got any Java Language Question?