在Java 9的JShell中使用变量
在 JShell 9 中,可以在会话期间声明变量。用户登录会话后,他们可以声明一个变量,如下所示 -
jshell> int val = 56 ;登录后复制
The above line would print the below output. The semicolon in the above line is optional, and it will run fine without the semicolon also.
输出
val = = > 56登录后复制
如果我们不将变量分配给值,而只是将其打印在 JShell 上,它会将变量分配给值 -
jshell> 79登录后复制