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![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Dinu Comendant](https://uploads.teamtreehouse.com/production/profile-photos/8558742/micro_67574933_472785873516384_4148477918722392064_n.jpg)
Dinu Comendant
6,049 PointsWhy is it "for( Treet...)"
As far as I know, for loop starts with the type, for example "for (String str : arr)", but here in the for loop starts with the class Treet and I don't understand why
2 Answers
![Steven Parker](https://uploads.teamtreehouse.com/production/profile-photos/969492/micro_tool_chess_set_2.jpg)
Steven Parker
230,688 PointsEvery class is also a type. The name of the class is also the type of any of its instances.
![Dinu Comendant](https://uploads.teamtreehouse.com/production/profile-photos/8558742/micro_67574933_472785873516384_4148477918722392064_n.jpg)
Dinu Comendant
6,049 PointsSo when do you need to use the class as the type instead of just using "String" and vice-versa? And is it common to use both concepts in actual coding?
![Steven Parker](https://uploads.teamtreehouse.com/production/profile-photos/969492/micro_tool_chess_set_2.jpg)
Steven Parker
230,688 PointsYou pick the type based on what you are going to do with the object. If it just holds text, you'd likely use a "String", But if it holds (for example) a set of student records, you'd probably use a "StudentInfo" class (assuming one had been defined already).