HomeAboutMeBlogGuest
© 2025 Sejin Cha. All rights reserved.
Built with Next.js, deployed on Vercel
🌚
[New] 우기팀
/
득윤
득윤
/
❓
Java Generic
/
4️⃣
제네릭과 서브타입
4️⃣

제네릭과 서브타입

제네릭, 상속과 서브 타입 (Generics, Inheritance, and Subtypes)

Box<Integer> is not a subtype of Box<Number> even though Integer is a subtype of Number.
Box<Integer> is not a subtype of Box<Number> even though Integer is a subtype of Number.
 

제네릭 클래스와 서브타입 (Generic Classes and Subtyping)

notion image
 
notion image
 
부모 제네릭 타입에서 선언되지 않은 타입 파라미터의 경우 자식 제네릭 타입에 선언 되어도 서브타입 관계에 영향을 주지 않음
interface PayloadList<E,P> extends List<E> { void setPayload(int index, P val); ... }
notion image