0

Why is there an error when I concatenate a String var with a char to form a new String and this char belongs to another String?

String S = ""; String name = "Julián"; S = S + name[1];

2nd Aug 2020, 5:59 PM
Adriel Mederos
Adriel Mederos - avatar
3 Respostas
+ 2
Which language? Tag the language pls... Edit: Adriel In java, you should use charAt method to access charecters in a string. S= S+ S.charAt(1); name[1] means name array value at index 1.
2nd Aug 2020, 6:14 PM
Jayakrishna 🇮🇳
0
Thanks, Jayakrishna. I forgot to specify the language but you managed to know it. Thanks again. I'm moving to Java from Delphi. In order to vote positively for your answer I have to check the inscription on mail, but I don't see the mail sent from SoloLearn. Do I have to activate PRO version?
2nd Aug 2020, 9:21 PM
Adriel Mederos
Adriel Mederos - avatar
0
Adriel no. check your spam folder in your mail.. if not found, just edit mail in settings and save.(edit to remove a char and save. again save to correct original mail). You get mail again... (Am also not verified but it works sure).
4th Aug 2020, 3:36 PM
Jayakrishna 🇮🇳