0
Why We Use ":" for Inside the for loop ?
I Can't Understand
2 Antworten
+ 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.
0
Ok It's Enough ...Now i understood Thank you