Computer programs, in their simplest form, really just do three things: First, they take input from the user; secondly, they manipulate that input in some manner; and thirdly, they send a response back to the client informing the user about how their input was handled. Interestingly, however, handling user input in a standalone Java application has always been rather onerous since it requires the use of InputStream objects and various esoteric input and output classes. Fortunately, additions to the JDK over the years have helped to simplify the task of obtaining input from the user. In this tutorial, the third in a series, we look at three of the best ways to handle user input in a simple, standalone Java application -- by using the Scanner class, the System's console object and the Swing package's JOptionPane.
By submitting your email address, you agree to receive emails regarding relevant topic offers from TechTarget and its partners. You can withdraw your consent at any time. Contact TechTarget at 275 Grove Street, Newton, MA.