0

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

app
  • 733
  • 5
  • 15
  • 27

1 Answers1

2

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.
Ryuzaki L
  • 37,302
  • 12
  • 68
  • 98
  • 1
    Might want to look into the *JShell completion API* to make the answer more useful. – Naman Apr 05 '19 at 02:19
  • can you point me there @Naman you mean this https://docs.oracle.com/javase/9/docs/api/jdk/jshell/package-summary.html – Ryuzaki L Apr 05 '19 at 14:43
  • [`SourceCodeAnalysis`](https://docs.oracle.com/javase/9/docs/api/jdk/jshell/SourceCodeAnalysis.Completeness.html) should be it precisely. This is though stated in the [JEP for Jshell](https://openjdk.java.net/jeps/222) – Naman Apr 05 '19 at 14:45