In this session we are discussing:
1)why do we need enhanced for loop if we already have a for loop.
2)enhanced for loop use to iterate values of arrays and collection
Important Points:
This enhanced for loop is used to traverse array or collection in Java
It works on the basis of elements and not the index.
It returns element one by one in the defined variable.
Syntax:
for(data_type variable : array_name)
{
// code block to be executed
}
Note: Do not confuse yourself with collection in upcoming lecture we will discussing the collection.
Download
0 formats
No download links available.
#16 Enhanced For Loop | For Each Loop in Java | NatokHD