0
What it means in java pls explain?
For(int i[]:array) {} what is this i[] and how it works on array???
4 Respuestas
+ 2
array must be a 2 dimensional Array 🤔
Meaning: For every 1d Array in the big Array
https://www.sololearn.com/learn/Java/2209/
https://www.sololearn.com/learn/Java/2149/?ref=app
+ 2
Piyush Srivastava open the links that I have shared you
+ 1
Namit Jain yeah it is a two dimensional array but how it works i didn't understand.
+ 1
Enhanced for loop:
for(declaration: expression){
//Statements
}
In the declaration part declare a variable of same type as of array in your case .In the expression part you have to place variable which you want to loop through.
Example:
int a[]={1,2,3,4,5}
for(int x:a)
{
System.out.println(x);
}
It will print 1,2,3,4,5 individually in a new line.