Interview Question

Interview Broomfield, CO

At this point, I don't remember an exact question, but in

  the technical interview they wanted to know why, not just how. E.g., why I would use the syntax of List<Foo> fooList = new ArrayList<Foo>() rather than ArrayList<Foo> fooList = new ArrayList<Foo>().

Interview Answer

1 Answer


Generally, one should keep variables as abstract as possible unless you need APIs specific from the "real" time. This gives you more opportunities to use your list in methods that as for a List parameter, E.g void foo(List x) could take an ArrayList, a LinkedList, or any other XXXList so long as it depends from List.

Tom C on Apr 23, 2015

Add Answers or Comments

To comment on this, Sign In or Sign Up.