add value with n variable with arraylist in java

Solutions on MaxInterview for add value with n variable with arraylist in java by the best coders in the world

showing results for - "add value with n variable with arraylist in java"
Fynn
06 May 2020
1Scanner in = new Scanner(System.in);
2int n = 5;
3ArrayList<String> addName = new ArrayList<>();
4for(int i = 0; i < n; i++){
5  addName.add(in.nextLine());
6}