5 pts.
 Java – scanner method and buffered reader method
I want to know what's difference between Scanner method & buffered reader method for scanning input from user? Why these multiple methods are used?

Software/Hardware used:
ASKED: February 25, 2009  6:09 AM
UPDATED: March 4, 2012  2:37 PM

Answer Wiki:
This may sound redundant, but BufferedReader is a reader, while Scanner is a scanner. From the <a href="http://java.sun.com/javase/6/docs/api/">documentation</a>: "java.util.Scanner is a simple text scanner which can parse primitive types and strings <b><i>using regular expressions</i></b>. <i><b>A Scanner breaks its input into tokens using a delimiter pattern</b></i>, which by default matches whitespace. The resulting tokens may then be converted into values of different types using the various next methods." and "java.io.BufferedReader <b><i>reads text from a character-input stream, buffering characters</i></b> so as to provide for the efficient reading of characters, arrays, and lines." Depending on what you need to accomplish, you might want to use a scanner or a buffered reader.
Last Wiki Answer Submitted:  February 25, 2009  8:31 pm  by  carlosdl   63,535 pts.
All Answer Wiki Contributors:  carlosdl   63,535 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

which one is better to be use in programs BufferedReader or scanner ??????

 10 pts.