Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Java Java Data Structures Efficiency! Custom Serialization

Kevin Carl David
Kevin Carl David
10,189 Points

Question about the array of strings in the loader

Hi,

in regard with the array of string being created in each line for the loader(title, artist and URL), I was just wondering how come even if the artist/title is more than 1 word, the size of array doesnt increase?

thanks

1 Answer

Hi! A String is a collection of characters. It doesn't matter if some of those characters are spaces. This is one String:

String stringWithOneWord = "Martha";

This is also one String:

String stringWithTwoWords = "Martha Jones";

And this too:

String stringWithFullSentence = "Martha Jones loves software development and chocolate!";

So the array of strings just stores one more string, and it doesn't care if there are several words inside that string. In fact that array does not know that this string contains several words.