Saturday, April 09, 2011

Read interactive command-line input with Java

The basic technique of reading a String provided by a user at a command-line is fairly simple, but more lengthy than you’d expect. It involves the use of the System.in object, along with the InputStreamReader and BufferedReader classes. The code in Listing 1 shows how you can prompt the user to enter a String value, such as their name, and then read that value. for more read this

No comments: