Many beginner programs rely on keyboard input read through DrJava provides full support for this. There are two ways to use in DrJava. First, you can invoke a method in your code that relies on in the Interactions Pane. When you do this, the input box will appear. Type your input, and press Return.

Alternatively, you can use the method in the Interactions Pane directly. When the input box appears, type your text and then either press Return.

When the the input box appears in the Interactions Pane, you can choose to close the input stream by selecting the menu item "Tools, Interactions & Console, Close", or by pressing the keyboard shortcut for it, which is Ctrl-D . The shortcut is labeled Close in the Key Bindings section of the preferences.

Here is an example of closing the input stream. The text in square brackets was entered by the user.

Welcome to DrJava.  Working directory is /Users/Shared/drjava
> // press Ctrl-D now

The user first types '1' and then presses Return. This lets DrJava read a 49, which is the ASCII code for the character '1', and then 10, which is the ASCII code for the new line created by Return. In the second input box, the user pressed Ctrl-D immediately to close the input stream. This lets DrJava read -1, indicating of the end of the stream.