0

enhanced for loop

i cant understand enhanced for loop. plz frnds explain to me

26th Jan 2017, 11:38 AM
S.Archana
S.Archana - avatar
1 Antwort
+ 1
Enhanced for loop java: Enhanced for loop is useful when scanning the array instead of using for loop. Syntax of enhanced for loop is: for (data_type variable: array_name) Here array_name is the name of array. Java enhanced for loop integer array class EnhancedForLoop { public static void main(String[] args) { int primes[] = { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29}; for (int t: primes) { System.out.println(t); } } }
26th Jan 2017, 2:09 PM
Jason Olszewski
Jason Olszewski - avatar