Such as Scanner sc=new Scanner (System.) in the Sc play what role, is just a temporary storage function
CodePudding user response:
Source code is this: in public final class Scanner implements Iterator , Closeable
Scanner realized the Iterator interface, can be said to be played the role of an Iterator System. This is an input stream in object, equivalent to read the content from the console, and the content of the sc is responsible for the read in a variety of ways to get out, such as nest (), nextInt (), nextString (), nextFloat (), etc.
CodePudding user response:
Source code comments as follows: a simple text scanner, you can use a regular expression parsing the basic types and string,