Skip to main content

endsWith() method & startsWith() method in java.

CODING:
class endstartwith
{
  public static void main(String args[])
   {
    String s1="Programming Example";
    System.out.println(s1.endsWith("e"));
    System.out.println(s1.endsWith("example"));
    System.out.println(s1.startsWith("P"));
    System.out.println(s1.startsWith("Prograz")); //we can also define string or char variable
   }

Comments