Using startsWith( ) and endsWith( ) methods

startsWith( ) method determines whether a given string starts with a specified string. (example- determines whether Sunny string starts with Sun string)
endsWith( ) method determines whether a given string ends with a specified string. (example- determines whether Starfish string ends with fish string)

Lets implement this on Eclipse IDE:

1. Create startsWithendsWithDemo class under any project as shown below:



2. Save and Run the 'startsWithendsWithDemo' class
3. Observe that the output is displayed in the console as shown below:



Download this project:

Click here to download the project containing the class files used in this post (You can download this project and import into Eclipse IDE on your machine)