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

public String concat(String str)

Example

@Test
public void whenCallConcat_thenCorrect() {
    assertEquals("elephant", "elep".concat("hant"));
}
Next »
Java String.contains()
« Previous
Java String.codePointAt()
Course – LS – All

Get started with Spring and Spring Boot, through the Learn Spring course:

>> CHECK OUT THE COURSE
res – REST with Spring (eBook) (everywhere)
Comments are open for 30 days after publishing a post. For any issues past this date, use the Contact form on the site.