Javatpoint Logo
Javatpoint Logo

Java String endsWith()

The java string endsWith() method checks if this string ends with given suffix. It returns true if this string ends with given suffix else returns false.


Internal implementation


Signature

The syntax or signature of endsWith() method is given below.


Parameter

suffix : Sequence of character


Returns

true or false


Java String endsWith() method example

Test it Now

Output:

true
true

Java String endsWith() Method Example 2

Output:

false
String ends with .com




Help Others, Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA