fastread homefastrread library fastread menu

Java : String endsWith

Tutorial by:Arena Buocel      Date: 2016-04-30 01:41:43

❰ Previous Next ❱

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.


Signature

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

 
  1. public boolean endsWith(String suffix)  

Parameter

suffix : Sequence of character


Returns

true or false


Java String endsWith() method example

 
  1. public class EndsWithExample{  
  2. public static void main(String args[]){  
  3. String s1="java by javatpoint";  
  4. System.out.println(s1.endsWith("t"));  
  5. System.out.println(s1.endsWith("point"));  
  6. }}  

Output:

true
true

❰ Previous Next ❱


Java

Submit Your Thought, Tutorial, Articls etc.

Submit Your Information India's Number one online promotion website