A Java Program to check the start and end of a String.
publicclass JAVA_047 { publicstaticvoid main(String[] args) { String Str="Too many cooks"; System.out.println("Str : " + Str); if(Str.startsWith("Too")) System.out.println("The String Str start with the sub-string \"Too\""); else System.out.println("The String Str do not start with the sub-string \"Too\""); if(Str.endsWith("COoks")) System.out.println("The String Str start with the sub-string \"COoks\""); else System.out.println("The String Str do not start with the sub-string \"COoks\""); } }