can we add String array into StringBuffer or StringBuilder in java? -



can we add String array into StringBuffer or StringBuilder in java? -

now developing simple project on java.in include string builder append , print strings on console.when trying append string array string builder,it prints object instead of array of strings on console.any 1 please tell whether seek right or wrong.

add arrays.tostring(yourarray) if want add together representation of string array. if it's multiple-dimension array (e.g. string[][]), add together arrays.deeptostring(yourarray) stringbuilder. adding array add together default string representation. finally, if need command on how represent array string, you'll need iterate elements , add together them stringbuilder in customized format.

edit

as side-note, create work arrays of custom objects, you'll want override object.tostring method, otherwise elements printed default string representation of object (i.e. this).

java arrays string stringbuilder stringbuffer

Comments