+ 6
Java strings
How two gets printed? https://code.sololearn.com/ckkSTVw6VRHU/?ref=app
12 Respostas
+ 3
You can use delimeter -here âaâ- to format the string as follows
String c=String.join(a,b,"");
+ 12
the correct syntax for join is:
String c=String.join(" ",a,b); // separation char is first argument
that will return the output: "one two"
+ 3
alagammai uma The right answer is like Lothar says.
First goes the delimiter and then strings to merge.
Look at api docs đ
https://docs.oracle.com/en/java/javase/14/docs/api/java.base/java/lang/String.html#join(java.lang.CharSequence,java.lang.CharSequence...)
đ If you want know how is implemented, you should take a look at StringBuilder or StringBuffer classes.
+ 2
Is your expected output is one two?
+ 2
I think so because there is no delimeter Because join takes a delimeter and it doesn't get it in your code. So printing the last string b
+ 2
alagammai uma pls tell incase of anymore help
+ 1
Atul nope
Wanna know the reason why it's two
+ 1
Sure
0
Atul ok thanks
0
public class Program
{
public static void main(String[] args)
{
String a="three";
String b="onetwo";
String c=String.join(a,b);
System.out.println(c);
}
}
//I think so I am correct đ
0
David OrdĂĄs ok thank-you
0
Please i don't know how start code help me