Java String endsWith - Java Language Basics

Java examples for Language Basics:String

Description

Java String endsWith

Demo Code


public class Main {
 
  public static void main(String[] args) {
    String strOrig = "Hello World";
   /*w  ww.  j a v a 2s  .  c o  m*/
    if(strOrig.endsWith("World")){
      System.out.println("String ends with World");
    }else{
      System.out.println("String does not end with World");
    }
  }
}

Result


Related Tutorials