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!
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
Daniel Ahmadizadeh1,979 Points
This last video was super confusing. I don't get why we couldn't just leave it as is. What is the need for the change?
Any additional resources for the last video would be super helpful. Thanks for your help!
String answerToLife = "42";
Sean Do11,933 Points
It would makes sense just leave it as is, as point of view being human. We(Humans) read as the example as number 42, but computer sees it as a String data type since it's enclose in quotes (" ").
String is a data type used to represent text rather numbers. It is comprised of a set of characters that can also contain spaces and numbers. Basically, anything that is enclose in quotation marks (" ") will be represented as text.
Integer is also a data type which represents whole numbers that be positive, negative, or zero.
It is best to rewatch the video, you'll need to use Integer.parseInt() for this code challenge.
hanzhang zhu1,033 Points
The reason we do parseInt is to change a string into int format. here "42" is a string, you need to use parseInt() function to switch it to int.