프로그래밍/JAVA
[JAVA] - 오류 : The type List is not generic; it cannot be parameterized with arguments
SH_다람이
2021. 4. 19. 16:25
반응형
오류 : The type List is not generic; it cannot be parameterized with arguments
위와 같이 리스트에 제네릭을 사용할 때 발생하는 오류 중 하나이다.
오류
import java.awt.List;
public List<MemberDTO> getMemberName(String name);
해결
import java.util.List;
public List<MemberDTO> getMemberName(String name);
원인
패키지(클래스)를 불러올 때,
import java.awt.List; 가 아니라
import java.util.List; 로 불러와야 합니다.
awt - 패키지는 드롭 다운 목록 GUI 요소를 만드는 데 사용되는 클래스입니다.
util - 패키지는 일반적으로 사용되는 컬렉션 인터페이스입니다.
반응형