package SRM;
import java.util.*;
public class Coding {
public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    ArrayList<Integer> arr = new ArrayList<>(20);
    System.out.println("Enter the elements in the array: ");
    for (int i = 0; i < arr.size(); i++) {
        int a = sc.nextInt();
        arr.add(a);
    }
    for (Iterator<Integer> it = arr.iterator(); it.hasNext();) {
        System.out.println(it.next());
    }
}
}
For loop not executing. it prints "Enter the elements in the array: " and then terminates the program instead going getting input. Help me solve the issue
