Java String.concat()

The method concat() concatenates two Strings. Simply put, it connects them into a single String. If the length of the argument is 0, then the method simply returns the String object.

Available Signatures

[source,java,gutter:,false]

public String concat(String str)

Example

[source,java,gutter:,true]

@Test
public void whenCallConcat_thenCorrect() {
    assertEquals("elephant", "elep".concat("hant"));
}