Using 'concat( )' method

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:



2. Save and Run the 'concateDemo' class file
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 file used in this post (You can download this project and import into Eclipse IDE on your machine)