For our first exercises, we will be using a command line tool known as a REPL, which stands for READ - EVALUATE - PRINT - LOOP. This process works as follows:
Luckily, setting up your REPL for Java is as easy as opening www.javarepl.com. For now, we will be using this web-based REPL for all of the Java Basics section.
Alternatively, for those of you with Macs, you can easily install javarepl onto your machine using Homebrew.
To install Homebrew, follow the instructions on Homebrew's website. Make sure to pay attention to the messages it gives you to configure your computer after it installs.
Then, just type
$ brew install javarepl. After it finishes, you can launch the REPL with
You can enter the Java REPL by typing
$ javarepl in the terminal at any time. You can exit at any point by hitting Ctrl + C.
At time of writing (Spring 2017) there is no easy to use solution to create a REPL on a windows machine, which is unfortunate. Our teachers have explored several options, but unfortunately, our best recommendation is to use the web-based REPL for Windows users.
For now, we will use the web-based JavaREPL.com as our REPL.
Alternatively, if you have a Mac with Homebrew installed, you may install a Java REPL by running the command
$ brew install javarepl.
Once installed, you may launch your REPL at any time with the command
Once open, you can exit the REPL with Ctrl + C.