Two String can be added in java with concat() method. concat() method concatenate string with each other and second string is added in tail of end of first string. The value two strings come with combine of both strings. Use of String concat () in java is shown below.
Example of String concat() in java
public class StringConcatenateJavaExample { public static void main(String[] args) { String string1="String concatenate "; String string2="Example in java"; String twoStrings= string1.concat(string2); System.out.println("Output of two :"+twoStrings); } }
Output
Output of two :String concatenate Example in java
Tags: String




Link to Us