how to get index in foreach loop in java code example
Example: java for loop with index
int index = 0;
for(Element song : question) {
System.out.println("Current index is: " + (index++));
}
int index = 0;
for(Element song : question) {
System.out.println("Current index is: " + (index++));
}