concat( ) method is used to concatenate two strings. It works similar to '+' operator.
Example:
"One".concat("Two") -> This will concatenate two string "One" and "Two" by resulting "OneTwo" string.
Lets implement this on Eclipse IDE:
1. Create 'concateDemo' class under any project as shown below:
3. Observe that the output is displayed in the console as shown below:
Click here to download the project containing the class file used in this post (You can download this project and import into Eclipse IDE on your machine)
Please comment below to feedback or ask questions.
Using 'replace( )' method will be explained in the next post.
No comments:
Post a Comment