Javatpoint Logo
Javatpoint Logo

Java Scanner delimiter() Method

The delimiter() is a method of Java Scanner class which is used to get the Pattern which the Scanner class is currently using to match delimiters.

Syntax

Following is the declaration of delimiter() method:

Parameter

This method does not accept any parameter.

Returns

The delimiter() method returns the Pattern which the Scanner class is using.

Exceptions

NA

Compatibility Version

Java 1.5 and above

Example 1

Output:

Hello! This is JavaTpoint.
\p{javaWhitespace}+

Example 2

Output:

Delimiter: \p{javaWhitespace}+
Hello
World!

Example 3

Output:

Enter Your Number: 4354655
Delimiter:\p{javaWhitespace}+
Number: 4354655
Scanner Closed.

Next TopicJava Scanner Class



Help Others, Please Share

facebook twitter pinterest