can i use this enhanced for loop all. instead of using for loop | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

can i use this enhanced for loop all. instead of using for loop

java

15th Aug 2017, 10:21 AM
corejava
11 Answers
+ 1
it is good when u want to traverse some element.
15th Aug 2017, 10:24 AM
shobhit
shobhit - avatar
+ 1
travel or (here)iterate something
15th Aug 2017, 10:25 AM
shobhit
shobhit - avatar
+ 1
it is used when u want to iterate through a given list u cannot put increment or decrement or other statements in it.
15th Aug 2017, 10:27 AM
shobhit
shobhit - avatar
+ 1
no they can be used outside arrays as well.
15th Aug 2017, 10:28 AM
shobhit
shobhit - avatar
+ 1
right and u need to go through them.
15th Aug 2017, 10:30 AM
shobhit
shobhit - avatar
+ 1
you can have your own class implement iterable interface and define your own iterator in it so it too can be iterated in for loop like java collection classes. pretty cool
15th Aug 2017, 12:20 PM
Gao Xiangshuai
Gao Xiangshuai - avatar
0
transverse means??
15th Aug 2017, 10:25 AM
corejava
0
I didn't get u😟
15th Aug 2017, 10:26 AM
corejava
0
are they can be used only in arrays of elements ??
15th Aug 2017, 10:27 AM
corejava
0
oh this is used when there is group of elements right
15th Aug 2017, 10:29 AM
corejava
0
thank u so much for u r help
15th Aug 2017, 10:30 AM
corejava