Java String ends with
public class Main { public static void main(String[] args) { String s = "demo2s.com"; /*from www . ja va 2 s . co m*/ boolean b = s.endsWith(".com"); System.out.println(b); } }