Hi,
What is for ( : ) in java.i know what a loop is but lately when i am doing excercises these keep coming up
Example:** for(Field currentField : emp.getClass().getDeclaredFields())**
Valiantangel
0
Newbie Poster
Recommended Answers
Jump to Postit's the enhanced for loop.
String[] myStrings = {"one","two","three","four"}; for ( int i = 0; i < myStrings.length; i++ ) System.out.println(myStrings[i]`);
does the exact same as
String[] myStrings = {"one","two","three","four"}; for ( String tempString : myStrings ) System.out.println(tempString);
All 4 Replies
stultuske
1,116
Posting Maven
Featured Poster
Valiantangel
0
Newbie Poster
jackbauer24
0
Junior Poster
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.