Java String endsWith() method

Facebooktwitterredditpinterestlinkedinmailby feather

Checks whether this String ends with the specified suffix or not.

Syntax

Parameter

Suffix : It takes suffix as a parameter  i.e. Sequence of characters

Returns

It returns true when the current String is matched with the given suffix. Otherwise, it returns false

Java String endsWith() Example 1:

Output:

Java String endsWith() Example 2:

Output:

Java String endsWith() Example 3:

Output:

Facebooktwitterredditpinterestlinkedinmailby feather

Leave a Comment