在JDK9之后,Java提供了命令行交互工具,就和Python的命令行非常类似,如果配置好Java环境变量,则在命令行z接输入jshell即可进入该交互模式
davieyang@bogon JavaTrainning % jshell
|  Welcome to JShell -- Version 11.0.5
|  For an introduction type: /help intro输入/help即可得到命令行工具的各种命令即描述
jshell> /help
|  Type a Java language expression, statement, or declaration.
|  Or type one of the following commands:
|  /list [<name or id>|-all|-start]
|      list the source you have typed
|  /edit <name or id>
|      edit a source entry
|  /drop <name or id>
|      delete a source entry
|  /save [-all|-history|-start] <file>
|      Save snippet source to a file
|  /open <file>
|      open a file as source input
|  /vars [<name or id>|-all|-start]
|      list the declared variables and their values
|  /methods [<name or id>|-all|-start]
|      list the declared methods and their signatures
|  /types [<name or id>|-all|-start]
|      list the type declarations
|  /imports 
|      list the imported items
|  /exit [<integer-expression-snippet>]
|      exit the jshell tool
|  /env [-class-path <path>] [-module-path <path>] [-add-modules <modules>] ...
|      view or change the evaluation context
|  /reset [-class-path <path>] [-module-path <path>] [-add-modules <modules>]...
|      reset the jshell tool
|  /reload [-restore] [-quiet] [-class-path <path>] [-module-path <path>]...
|      reset and replay relevant history -- current or previous (-restore)
|  /history [-all]
|      history of what you have typed
|  /help [<command>|<subject>]
|      get information about using the jshell tool
|  /set editor|start|feedback|mode|prompt|truncation|format ...
|      set configuration information
|  /? [<command>|<subject>]
|      get information about using the jshell tool
|  /! 
|      rerun last snippet -- see /help rerun
|  /<id> 
|      rerun snippets by ID or ID range -- see /help rerun
|  /-<n> 
|      rerun n-th previous snippet -- see /help rerun
|  
|  For more information type '/help' followed by the name of a
|  command or a subject.
|  For example '/help /list' or '/help intro'.
|  
|  Subjects:
|  
|  intro
|      an introduction to the jshell tool
|  id
|      a description of snippet IDs and how use them
|  shortcuts
|      a description of keystrokes for snippet and command completion,
|      information access, and automatic code generation
|  context
|      a description of the evaluation context options for /env /reload and /reset
|  rerun
|      a description of ways to re-evaluate previously entered snippetsJshell中创建数组和初始化数组
C:\Users\Administrator>jshell
|  Welcome to JShell -- Version 11.0.6
|  For an introduction type: /help intro
jshell> Object[] objArr;
objArr ==> null
jshell> objArr = new String[] {"java", "davieyang"}
objArr ==> String[2] { "java", "davieyang" }
jshell> Object[] objArr2;
objArr2 ==> null
jshell> objArr2 = new Object[] {"java", "davieyang"}
objArr2 ==> Object[2] { "java", "davieyang" }
jshell> int[] intArr;
intArr ==> null
jshell> intArr = new int[] {1,2,3,4,5}
intArr ==> int[5] { 1, 2, 3, 4, 5 }









