String methods – Concat and contains

In this post, we will see 2 string methods which are  concat and contains.

String concat(String str):

The method appends a specified string to the end of this string.

If the length of the string is 0, after concatenating a new string will return. We can concatenate multiple strings as well as shown in the code below.

New string object
Hello world!!How are you.

boolean contains(CharSequence s):

This method finds the sequence of characters in the any string and returns true if matches ,else false.

Ask Question
Have any question or suggestion for us?Please feel free to post in Q&A Forum
String methods - charAt() and compareTo()
String methods - startsWith and endsWith
Shekhar Sharma

Shekhar Sharma

Shekhar Sharma is founder of He is an automation engineer having more than 8 years of experience who loves troubleshooting in automation and finding innovative ways to solve the problems. His other leisurely activities includes playing harmonica, paintings, sketching portrait, watching movies and travelling etc.

You may also like...