1public class Demo {
2    public static void main(String[] args) {
3       String str = "demo";
4       if(str.endsWith("mo")) {
5          System.out.println("The string ends with the word mo");
6       } else {
7          System.out.println("The string does not end with the word mo");
8       }
9    }
10}