what is the output of given java for() loop ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

what is the output of given java for() loop ?

public class Program { public static void main(String[] args) { int[ ] primes = {2, 3, 5, 7}; int i=0; for (int t: primes) { System.out.println(t); System.out.println(primes[i]); i++; } } }

5th Mar 2017, 11:55 AM
jaswinder singh
jaswinder singh - avatar
1 Answer
- 1
2 2 3 3 5 5 7 7
5th Mar 2017, 12:08 PM
Fahad
Fahad - avatar