Strings | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Strings

Good morning! Each time i code and when i am dealing with strings i face a problem for example when i initialize a string in this way: String[] say="Hello"; and in this way: String talk="Hello"; when i use for example the method say.equals(talk); i got an arror telling cannot convert from String[] to String.. So my question is that i want to know the difference between them Thank you in advance!

17th Nov 2018, 2:21 PM
Liza BOUMALI
Liza BOUMALI - avatar
7 Answers
+ 6
String[] say; This is a String array, on the other hand; String talk; is a String variable, an array is like a matchbox, one matchbox contains many match sticks, a String array is a variable that can hold multiple references of String, an array can contain only values of the same type as the array. I don't know if you have got to the chapter covering about arrays, but if you did, I guess a review on the chapter couldn't hurt. Feel free to ask if you still feel like not getting it right : )
18th Nov 2018, 2:13 AM
Ipang
+ 2
Hello
18th Dec 2020, 3:47 PM
Prabhat
Prabhat - avatar
+ 1
You want to know differences between String and string[]? So,I don’t know it for 100%,but into [] after string you could add some func or something.I hope this help😉
17th Nov 2018, 8:07 PM
Ben
Ben - avatar
0
Ben i didn't get tje answer but thank you anyways
17th Nov 2018, 8:32 PM
Liza BOUMALI
Liza BOUMALI - avatar
0
Oh,so sorry not professional english translator😶
17th Nov 2018, 8:45 PM
Ben
Ben - avatar
0
😂
26th Feb 2021, 4:52 AM
Chriskeins c.s.
Chriskeins c.s. - avatar
0
🤣🤣🤣🤣🤣
17th Mar 2021, 10:38 AM
Free fiare K.G
Free fiare K.G - avatar