慕码人8056858
来自 Javadoc:类扫描器| Constructor | Description ||---------------------------------------------------------|----------------------------------------------------------------------------------------|| Scanner(File source) | Constructs a new Scanner that produces values scanned from the specified file. || Scanner(File source, String charsetName) | Constructs a new Scanner that produces values scanned from the specified file. || Scanner(File source, Charset charset) | Constructs a new Scanner that produces values scanned from the specified file. || Scanner(InputStream source) | Constructs a new Scanner that produces values scanned from the specified input stream. || Scanner(InputStream source, String charsetName) | Constructs a new Scanner that produces values scanned from the specified input stream. || Scanner(InputStream source, Charset charset) | Constructs a new Scanner that produces values scanned from the specified input stream. || Scanner(Readable source) | Constructs a new Scanner that produces values scanned from the specified source. || Scanner(String source) | Constructs a new Scanner that produces values scanned from the specified string. || Scanner(ReadableByteChannel source) | Constructs a new Scanner that produces values scanned from the specified channel. || Scanner(ReadableByteChannel source, String charsetName) | Constructs a new Scanner that produces values scanned from the specified channel. || Scanner(Path source) | Constructs a new Scanner that produces values scanned from the specified file. || Scanner(Path source, String charsetName) | Constructs a new Scanner that produces values scanned from the specified file. || Scanner(Path source, Charset charset) | Constructs a new Scanner that produces values scanned from the specified file. |要指定您想要哪种类型的扫描仪,您必须传递一个参数。System.in 告诉 Scanner 类,从InputStream source