java startsWith() and endsWith() string method example

class sm4
{
	public static void main(String args[])
	{
		String str1=new String("I like");
		System.out.println(str1.startsWith("I"));
		System.out.println(str1.startsWith("i"));
		System.out.println(str1.endsWith("e"));
		System.out.println(str1.endsWith("E"));
	}
}

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *