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 trialEsteban Montesinos
Courses Plus Student 79 Pointscan someone explain to me what ":" this means in java for example in the case of a for loop for(Book tempbook:results)
can someone explain to me what (" : " ) means in java for example in the case of a for loop. for(Book tempbook:results){
1 Answer
Kayondo Martin
7,481 PointsI assume you have an array or collection of Book objects called results, what "for(Book tempBook: result)" means is; for every Book object found in the collection "result"...do something(according to your following code). In other words, simply put, the : means "in"
Chase Carnaroli
5,139 PointsChase Carnaroli
5,139 PointsThis is also known as a "for-each loop"