Top three ways to handle Java user input in a standalone Java app
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.
31 Aug 2012