0

i've been wondering how does the interface List in java store data. An interface is a set of methods that must be implemented by a class (please correct if i'm wrong) and thus a list can't have variables to store data. For instance, List<Integer> list1 = new ArrayList<>(); list1.add(5); where will the integer 5 be stored ? Does the list1 use the ArrayList's attributes to store data ? What really happens when i create an interface ? Does it create an object of a certain class to operate on it ? Thank you

Ousmane D.
  • 54,915
  • 8
  • 91
  • 126

0 Answers0