Skip to content

Programming against an interface

A field is declared as List<String> rather than ArrayList<String>, even though an ArrayList is assigned to it.

Why prefer the interface type?