What does this for(:) mean in Java?

前端 未结 2 884
醉梦人生
醉梦人生 2021-01-17 06:22
package MyTest;

import java.beans.BeanInfo;
import java.beans.Introspector;
import java.beans.PropertyDescriptor;

class Person {
...
}

class Student extends Perso         


        
相关标签:
2条回答
  • 2021-01-17 06:42

    That's the for each loop syntax, introduced in Java 5.

    0 讨论(0)
  • 2021-01-17 06:42

    It's a for-each loop over the Collection "props". It iterates over all entries of the collection. During each loop iteration, "prop" is the currently processed entry. You can do that with any container class which implements Iterable as well as arrays.

    0 讨论(0)
提交回复
热议问题