Skip to content
Advertisement

Tag: jshell

Why does jshell show this number?

I am learning java and this logic makes me feel confused. Isn’t here i=20(+1)+20(+1)? Why 41 instead of 42? See this code run at Ideone.com. Answer Effectively, the expression i=i++ + i++; is equal to i=i++ + i;. Why? The latter i++ result value is never used and is not propagated. The result of the postfix addition i++ is used

How to quit the JShell and go back to the command-line?

When using the JShell, how do I exit it back to the CMD line? I have already tried ctrl + x and just writing quit, but to no joy. Answer You can use the JShell command to exit as: Side note: Interestingly, with the use of command abbreviations for input shortcuts:- (of course /exi) also, resolves into the same command.

Advertisement