In this we will discuss about the Java I/O Scanning and Formatting.
In the perspective of programming in Java I/O we are ( i.e. human being) able to read neatly formatted data to work with. When a programmer does programming of I/O the input data undergoes with the translation and retrieves a human readable neatly formatted data to work with. For this Java provides the two APIs namely scanner and the formatting. The scanner API is responsible for breaking the input data into the particular tokens which are associated with the bits of data whereas, formatting API is responsible for assembling the individual tokens associated with the bits of data to a human readable form.
Java provides a class java.util.Scanner object of which are used to break the formatted input data to the particular tokens according to their data type. Scanner separates the tokens using a delimiter, the default delimiter that the Scanner uses is the white space except this to use a delimiter one can use the useDelimiter() method by giving a specified pattern.
Methods of Scanner
There are various of methods of Scanner class some of mostly used methods are as follows :
In Java to create a formatted output stream there are two classes PrintWriter and PrintStream.
PrintStream is a byte stream class whereas, the PrintWriter is a character stream class. Both of the classes have same methods for writing and formatting the input data.
Recommend the tutorial