How to check whether a string ends with another string in Java

1 Answer

0 votes
public class MyClass {
    public static void main(String args[]) {
        String s = "java c php python";

        if (s.endsWith("python"))
            System.out.println("yes");
        else
            System.out.println("no");
    }
}



/*
run:

yes

*/

 



answered Nov 14, 2019 by avibootz

Related questions

3 answers 245 views
1 answer 162 views
1 answer 140 views
3 answers 177 views
1 answer 169 views
3 answers 213 views
...