List<String> strings = new ArrayList<>(); ---> not accepted;
ArrayList<String> = new ArrayList<>(); ----> Accepted;
I don't think it's something wrong with the first type of declaration.
List or Arraylist
Archived
Comments (1)
- Popular
- New
- Old
You must be signed in to leave a comment
Nouser
3 April 2021, 07:40
If I remember correctly, then some of the tasks in the syntax quest didn't allow assigning ArrayList to a List reference variable. Nevertheless that should be the preferred method. You'll learn soon about interfaces and the downsides, that you here can't use the additional methods ArrayList has anymore. If you need them you should of course use an ArrayList reference variable.
0