Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Java Java Objects Meet Objects Welcome Back

Hi my name is Sebastian, I didin't understand what is the Jshell for?

In wich cases would I be using it?

It is used to learn the language and just test and prototype your program. When you enter a variable or do a command you do not need to compile the program and run it. It will do it automatically for you.

This is the official site from oracle it explains pretty well: https://docs.oracle.com/javase/9/jshell/introduction-jshell.htm#JSHEL-GUID-630F27C8-1195-4989-9F6B-2C51D46F52C8

4 Answers

Hello Sebastian,

"The Java Shell tool (JShell) is an interactive tool for learning the Java programming language and prototyping Java code. JShell is a Read-Evaluate-Print Loop (REPL), which evaluates declarations, statements, and expressions as they are entered and immediately shows the results." - Oracle

To put it simply, it's like 'creative/sandbox mode' for Java. You are able to test out things without adding things to code your working on.

If you want to learn a bit more CLICK HERE to go to Oracles Introduction to JShell.

To quickly test snippets of code. I used it for Reg Exes and Complicated expressions

But doesn't this only work for one line code? How in depth can you get with jshell?

can we use it for unit testing as well?