Pages

Determine String end with specified word

Complete source code below will show you, how to determine whether a String end with specified word or not.

**************************************************************************
COMPLETE SOURCE CODE FOR : DetermineStringEndWithWord.java
**************************************************************************


public class DetermineStringEndWithWord
{
public static void main(String[]args)
{
//First String
//You can try change it
String a="Hello";

//Second String
//You can try change it
String b="llo";

//Determine if first String end with second String or not
//If yes, program will print YES, otherwise it will print NO
if(a.endsWith(b))
{
System.out.println("YES");
}
else
{
System.out.println("NO");
}
}
}


**************************************************************************
JUST COMPILE AND EXECUTE IT
**************************************************************************
Related Posts Plugin for WordPress, Blogger...