endsWith() - String Methods in Java


This article is a part of String Methods in Java.
The endsWith() method checks whether the string ends with the specified characters or not. The parameter passed in this method is of string type, representing the characters to be checked.


Return type

The endsWith() method returns a Boolean value. It returns true if the string ends with the specified characters and false otherwise.
Let us look at an example code to understand this method.

Example


Output

Let us look at the output of the above example code.

String Methods endsWith()
Fig.1- String Method - endsWith()

Read More

Author : Satyam Kumar -



You will also like: