how to check the end of a string java

Solutions on MaxInterview for how to check the end of a string java by the best coders in the world

showing results for - "how to check the end of a string java"
Katy
21 Feb 2017
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}