Reading a multiline input
Reading multiline input may still be a bit tricky: we should take into account the position of a cursor and the reading methods behavior. Let’s investigate this process with an example: | This is a simple multiline input, that is being read | is a position of a cursor before reading the input. If we invoke next() method, the program will read the input till the whitespace, which is indicated by blue color: This | is a simple multiline input, that is being read After invoking nextLine() method the program reads the whole line starting from the whitespace. This data is indicated by green color. nextLine() places the cursor at the beginning of a new line (if there is such a line in our input): This is a simple | multiline input, that is being read Then, let's invoke next() method two times. The first input is indicated by orange color. we may see that the position of the cursor is right after the word and before the whitespace: This is a simple multiline| inp...