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 trialMiguel Rivas
4,902 PointsCast to a Treet (?)
Hello there, Im wondering if you can explain to me the meaning "cast to a treet", well Craig said that in min 07:34 in Interfaces (java)
Is this "cast to a Treet" the same as converting a String that is given as a parameter within the method to an Object?
I mean, I'm seeing it this way. I write a String, the method receives that String as a parameter and the casting "converts" that String into an object? Is that it?
Im sorry but english is my second language and I'm finding myself lost understanding the "cast" word.
2 Answers
Florian Tönjes
Full Stack JavaScript Techdegree Graduate 50,856 PointsHi Miguel,
with casting you kind of force a variable into a new type. The new type has to be compatible with the old one or you'll get a ClassCastException. It's a rather complex topic. I recommend this article.
Kind Regards, Florian
Miguel Rivas
4,902 PointsThank you Florian, I see what you mean.
Nice avatar btw :)