-4

How this for loop statement works? Can we only use it to print arrays?

for (Integer i : arrayToSort){
        System.out.println(i.intValue());
    }

1 Answers1

-1

This is the for-each loop, you can use it like the normal for-loop. Only the syntax is different. Please look at the https://docs.oracle.com/javase/8/docs/technotes/guides/language/foreach.html

Oguz Ozcan
  • 1,497
  • 13
  • 21