String Manipulation

concat method

In fact, you can concatenate two strings by using the + operator. In this page, you will learn another way to concatenate two strings. You can use the concat(String) method to combine to strings.

Example:


public class JavaExercises
{
public static void main(String[] args)
{
  strmanip();
}

static void strmanip(){

    String st1="Learn Java";
    String st2=" programming";
    String st3=st1.concat(st2);
    System.out.println("st1:"+st1);
    System.out.println("st2:"+st2);
    System.out.println("The result from concatenating:"+st3);   
          }
}



HTML Comment Box is loading comments...



This website intents to provide free and high quality tutorials, examples, exercises and solutions, questions and answers of programming and scripting languages:
C, C++, C#, Java, VB.NET, Python, VBA,PHP & Mysql, SQL, JSP, ASP.NET,HTML, CSS, JQuery, JavaScript and other applications such as MS Excel, MS Access, and MS Word. However, we don't guarantee all things of the web are accurate. If you find any error, please report it then we will take actions to correct it as soon as possible.