For each loop:
For each loop is a special loop of java it is used to
traverse the elements of collection or array
Foreach loop variables are auto undateable no need to
update the loop variables
Syntax
for( datatype variableName : Array of collection name )
{
//print
}
Example :
For ( int n : arr)
{
[Link]( n+” ”)
}
2D Array :
2D Array is a collection of multiple arrays with same
datatype in which we can store value in 2 dimensions ,
one is row and second is column.
If we want to access an element of 2D array then we
have to use indexes for rows and columns same as
matrix
String :
Technically String is a class it is sed to store or
represent collection or sequence of characters it is found
inside the [Link] package