Can anybody tell me how to print the index number of elements in the ArrayList using for each looping in Java.
You have to keep track of the index numbers yourself, as you loop through the ArrayList. The List iterator won't do that for you.
You'd normally do that through a separate variable. You could store objects with an associated index, but you'd have to be sure to maintain ordering (by not deleting, resorting etc.)