Java 中 nextInt, next, nextLine 的区别:读入内容,读入后光标位置
nextInt():
it only reads the int value, nextInt() places the cursor inthe same line after reading the input.
只读入int值,在读入后把光标放在同一行。
next():
read the input only till the space. It can’t read two wordsseparated by space. Also, next() places the cursor in the same line
after reading the input.
读入输入直到遇到空格,在读入后把光标放在同一行。
nextLine():
reads input including space between the words (that is,it reads till the end of line \n). Once the input is read, nextLine()positions the cursor in the next line.
读入直到遇到\n,在读入后把光标放在下一行。

浙公网安备 33010602011771号