public class StartsWith { public static void main(String[] args) { //declare the original String String strOrig = "Forget Code"; if(strOrig.startsWith("Forget")){ System.out.println("String starts with Forget"); }else{ System.out.println("String does not start with Forget"); } } }