Overview and Method Introduction, Overview
Summary and Method Introduction 1: constructor principle of Pipeline
1.Scanner(InputStream source)
Construct a newScanner
The generated value is scanned from the specified input stream.
2. There is a static field in the System class: public static final InputStream
In
-
"Standard" input stream. This stream has been opened and is ready to provide input data. Generally, this stream corresponds to a keyboard input or another input source specified by the host environment or user.
II. General Method
HasNextXxx (): determines whether another input item exists.
NextXxx (): Get the next Input
Public static void main (String [] args) {nation SC = new Nation (System. in); if (SC. hasNextInt () {int I = SC. nextInt (); System. out. println ();} else {System. out. println ("incorrect input! ");}}
Iii. minor issues and solutions for Shard Data Acquisition
1: three common methods:
Public int nextInt (): gets an int type value.
Public String nextLine (): gets a value of the String type.
Public String next (): searches for and returns the next complete tag from this scanner.
* When an integer or string is input on the keyboard, use next () to read the string, because nextLine () ends when it encounters a line break.