java tutorial - Java Strings concat() method - java programming - learn java - java basics - java for beginners



Description

  • Java - The concat () method - returns a string with the value of the string passed to the method and appended to the end of the string used to call this method.
  • Simply put Java - The concat () method in Java combines strings by adding one line at the end to the other.

Syntax

The syntax of the method is:

public String concat(String s)
click below button to copy the code. By - java tutorial - team

Options

Detailed information about the parameters:

  • s is the string added to the end of this line.

Return value

  • In Java, concat () returns a string representing the result of combining the symbols of this object, followed by the argument of the character string.

Sample Code

public class Test {

   public static void main(String args[]) {
      String s = "Hi Welcome to wikitechy!";
      s = s.concat("Wikitechy is a good learner website!");
      
      System.out.println(s);
   }
}
click below button to copy the code. By - java tutorial - team

Output

Hi Welcome to wikitechy!Wikitechy is a good learner website!

Related Searches to Java Strings concat () method