Using BufferedReader to read input number from user

This example shows how to read input from console using the BufferedReader class. The BufferedReader has a neat method called readLine() that reads all the input characters into a string when the user hits the Enter button instead of reading byte by byte.
This example takes the input string and parses it into a variable of type Double and then prints out the square root of that number.
This is the code:

So if we for example type in 12345, the output from the program looks like:

Search for more Java info on this site here:
Custom Search

Please type any questions here.