0

What it means in java pls explain?

For(int i[]:array) {} what is this i[] and how it works on array???

27th Aug 2020, 5:40 PM
Piyush Srivastava
Piyush Srivastava - avatar
4 Antworten
+ 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
27th Aug 2020, 5:43 PM
Namit Jain
Namit Jain - avatar
+ 2
Piyush Srivastava open the links that I have shared you
27th Aug 2020, 5:53 PM
Namit Jain
Namit Jain - avatar
+ 1
Namit Jain yeah it is a two dimensional array but how it works i didn't understand.
27th Aug 2020, 5:45 PM
Piyush Srivastava
Piyush Srivastava - avatar
+ 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.
27th Aug 2020, 5:54 PM
shubham kumar
shubham kumar - avatar