차이점은 무엇입니까
List<String> lst = new LinkedList<>();
과
LinkedList<String> lst = new LinkedList<>();
차이점은 무엇입니까
List<String> lst = new LinkedList<>();
과
LinkedList<String> lst = new LinkedList<>();
편의성 외에 다른 점은 없습니다. 첫 번째 경우 LinkedList
를 다른 List
구현 (예 : ArrayList
)으로 변경할 수 있습니다. 예를 들어 다른 코드를 변경할 필요없이 응용 프로그램에서 더 잘 작동합니다.
출처 : https://stackoverflow.com/questions/63023354/what-is-the-difference-between-polymorphism