Java Scanner tokens() Method
The tokens() method of Java Scanner class is used to get a stream of delimiter-separated tokens from the Scanner object which are in using. This method might block waiting for more input.
Following is the declaration of tokens() method:
This method does not accept any parameter.
The tokens() method returns a sequential stream of token strings.
IllegalStateException- It will thrown this Exception if the innvocation is done after Scanner is closed.
Java 1.9 and above
JavaTpoint Abhishek Male 22
1 2 red blue