The method add(String) is undefined for the type String
up vote 0 down vote favorite ArrayList<String> indirizzi = new ArrayList<String>(); for(int i=0; i<n; i++) String ind = in.nextLine(); indirizzi.get(i).add(ind); The method add(String) is undefined for the type String . This program gives me the above error. I don't understand why. java share | improve this question edited Nov 11 at 22:59 GBlodgett 8,525 4 15 31 asked Nov 11 at 22:50 user10610048 67 6 add a comment | up vote 0 down vote favorite ArrayList<String> indirizzi = new ArrayList<String>(); for(int i=0; i<n; i++) String ind = in.nextLine(); indirizzi.get(i).add(ind); The method add(String) is undefined for the type String . This program gives me the above error. I don't understand why. java share | improve this question edited Nov 11 at 22:59 GBlodgett 8,525 4 15 31 asked Nov 11 at 22:50 user10610048 67 6 ...