1. The space, tab key and enter key encountered before the next() method encounters a valid character cannot be used as a terminator, the next() method will automatically remove it, only when the next() method encounters a valid character After that, the next() method treats the space key, Tab key, or Enter key entered later as a separator or terminator, so next() cannot get the string with spaces, only part of the string (space front).
2. The terminator of the nextLine() method is the Enter key, that is, the nextLine() method returns all the strings before the Enter key, so the nextLine() method can get the string with spaces.
Read More:
- [Solved] ERROR org.springframework.boot.SpringApplication – Application run failed org.yaml.snakeyaml.scanner
- Non empty judgment method: the difference between isnotempty and isnotblank. isNullOrEmpty
- The principle and return value of get() function in C language
- [Solved] o2o Error: addShopImg error:null / character to be escaped is missing
- SpringMVc @RequestMapping url of regular expression pattern
- [Solved] Java Run Error: For input string: “XXX”
- Error: char cannot be dereferenced [How to Solve]
- Java parsing xml file encounters special symbols & will be abnormal solutions
- org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Cannot deseria
- try-with-resource automatically closes the resources of the AutoClosable interface
- [Solved] IDEA globally replace yml Error: you have entered malformed replacement
- [Solved] SpringBoot Date Convert Error: JSON parse error: Cannot deserialize value of type `java.time.LocalDateTime`
- [Solved] Mybatis insert Error: Cause: java.sql.SQLException: SQL String cannot be empty
- How to convert a Java string into a number (stringtonumber)
- [How to Solve] Java nested object @validated is not valid
- [Solved] Circular view path [index]: would dispatch back to the current handler URL [] again. Che
- [Solved] Crypto-JS Failed to Decrypt Error: Uncaught Error: Malformed UTF-8 data
- JAVA: How to Solve Foreach Loop Remove/add Element Error
- JAVA: How to Read JSON Format Data (Web Game Development)
- Using Post no Body Error: socket hang up [How to Solve]