From the course: Oracle Java Foundations

Unlock this course with a free trial

Join today to access over 24,000 courses taught by industry experts.

JShell

JShell

(upbeat music) (logo whooshes) - [Joe] Jshell. JShell is an interactive Read-Evaluate-Print Loop command-line tool to lighter test out Java code without having to write full programs. You can learn the Java programming language and even prototype Java code very simply and easily. It'll evaluate declarations, statements, and expressions as they're typed in and as they're entered. It'll show you the results immediately. So looking at an example, we can invoke JShell by just typing jshell at the command-line. Then if we type int x, indicating we want to integer x variable = 1, it'll assign the value 1 to x. Then if we say int y = 1, it'll create an integer y variable and assign it the value 1. And then if we type x + y, it'll add the two together. 1 + 1 gives us 2. To exit Jshell, we just simply do /exit, and that exits JShell back to the command-line. Here's a reference for you if you need help and you want to play with this. Here's the /exit that gets you out, /list. Notice all the…

Contents