The Java String contains() method is used to check whether the specific set of characters are part of the given string or not. It returns a boolean value true if the specified characters are substring of a given string and returns false otherwise. It can be directly used inside the if statement.
Read moreHow do you find special characters in a string?
Follow the steps below to solve the problem:
Read moreHow do you check if there is a special character in a string Java?
Java Program to Check String Contains Special Characters
Read more