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 265 views
1 answer 180 views
1 answer 151 views
3 answers 194 views
1 answer 176 views
3 answers 237 views
...