Overview and Method Introduction, Overview

Source: Internet
Author: User

Overview and Method Introduction, Overview
Summary and Method Introduction 1: constructor principle of Pipeline

1.Scanner(InputStream source)

Construct a newScannerThe 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.

    

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.