👤

what are the two ways of concatenating two strings? group of answer choices use the concat() method, or the trim() method use the concat() method, or use the between the two strings use the concatenate() method, or use the between the two strings use the contenate() method, or the concat() method

Answer :

The two ways to use concatenate the strings are

(String concatenation) operator.

using the concat method

What is a concat method ?

String concatenation in Java is accomplished through the StringBuilder (or StringBuffer) class and its append method. By appending the second operand to the end of the first operand, the String concatenation operator creates a new String. String concatenation can concatenate not only Strings but also primitive values. As an example,

class TestStringConcat{

public static void main(String args[]){

String s1="Test";

String s2="Test";

String s3=s1.concat(s2);

System.out.println(s3);//TestTest

}

}

string concatenation

class TestingStringConcatenation1{

public static void main(String args[]){

String a="Test"+" Test";

System.out.println(a);//TestTest

}

}

Hence the conclude that concat and By+string concatenation are the two methods used

To know more about concatenation follow this link:

https://brainly.com/question/16185207

#SPJ4