Friday, 1 January 2016

String Concatenation in Java

Concatenating Strings in Java

How to add two Strings in Java

               In Java, there is class named String contains method concat() for concatenating stings. The concat method can be used as follows:

     Type 1: string1.cancat(string2);
     Type 2: "Sun rises ".concat("in the east");

               Another common way to add strings in java is with the help of the '+' operator. 

     Example: "Sun rises "+"in the east";

No comments :

Post a Comment