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 435 views
1 answer 283 views
1 answer 255 views
3 answers 353 views
1 answer 283 views
3 answers 387 views
...