-9

hi, can anyone tell me what ":" operator does and please explain the below condition statement?

for(String key:keyset) -----> what : operator does
Sesha
  • 3
  • 4

1 Answers1

3

It's not an operator, it's just part of the syntax. What you see is the enhanced for loop or for-each loop. It iterates over keyset and binds each string it contains to the variable key one after another in each iteration.

André Stannek
  • 7,773
  • 31
  • 52