Back To Java String Class Index
//program to demonstrate endswith method of String class public class stringendswith { public static void main(String[] args) { String ob=new String("abcdef"); boolean result; result=ob.endsWith("ef"); if(result==true) { System.out.println("string ends with ef"); } else { System.out.println("string does not ends with ef"); } } }