简体   繁体   中英

How Jshell works without semicolon at end of line

I'm new for java 9 and just practicing some snippet of code on jshell

 jshell> System.out.println("hello");
 hello

 jshell> System.out.println("hello")
 hello

In the both the cases I'm getting output of hello but jshell works without semicolon at end of line. I know java need semicolon

Jshell adds the semicolon automatically . Doc-Page-2-1 or here

Snippets of Java code are entered into JShell and immediately evaluated. Feedback about the results, actions performed, and any errors that occurred is shown

Note:

Terminating semicolons are automatically added to the end of a complete snippet if not entered.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM