0

Why We Use ":" for Inside the for loop ?

I Can't Understand

14th Sep 2019, 1:53 PM
GNANASEKARAN M
GNANASEKARAN M - avatar
2 Réponses
+ 2
In which language? Your profile says you're learning Java; a colon is sometimes used to cycle through an array. For example, if you have an integer array "arr" that is equal to [1, 2, 3] then you can use: for (int i: arr) { System.out.println(i); } This outputs: 1 2 3 This can also be used to cycle through a list of objects and call their methods.
14th Sep 2019, 1:58 PM
Daniel C
Daniel C - avatar
0
Ok It's Enough ...Now i understood Thank you
14th Sep 2019, 2:01 PM
GNANASEKARAN M
GNANASEKARAN M - avatar