The matches() method of Matcher Class is used to get the result whether this pattern matches with this matcher or not. It returns a boolean value showing the same.
public boolean matches()
Parameters: This method do not takes any parameter.
Return Value: This method returns a boolean value showing whether this pattern matches with this matcher or not.
Below examples illustrate the Matcher.matches() method:
Reference: Oracle Doc
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready.