와일드카드 Wildcards
제네릭 코드에서, 와일드카드 라고 하는 물음표 (?)는 알 수 없는 타입을 나타냅니다.
와일드카드는 다양한 상황에서 사용될 수 있습니다: 매개변수의 타입, 필드 또는 로컬변수로; 때로는 반환 타입으로 (보다 구체적인 프로그래밍 습관이 바람직하지만).
와일드카드는 제네릭 메소드 호출에 대한 타입 아규먼트, 제네릭 클래스 인스턴스 생성 또는 슈퍼타입으로 는 사용되지 않습니다.
다음 섹션에서는 상위 경계 와일드카드, 낮은 경계 와일드카드 및 와일드카드 캡처를 포함한 와일드카드를 보다 상세하게 설명합니다.
In generic code, the question mark (?), called the wildcard, represents an unknown type. The wildcard can be used in a variety of situations: as the type of a parameter, field, or local variable; sometimes as a return type (though it is better programming practice to be more specific). The wildcard is never used as a type argument for a generic method invocation, a generic class instance creation, or a supertype.
The following sections discuss wildcards in more detail, including upper bounded wildcards, lower bounded wildcards, and wildcard capture.
'Java 배우기' 카테고리의 다른 글
Unbounded Wildcards 언바운디드 와일드카드 (0) | 2016.01.24 |
---|---|
Upper Bounded Wildcards 어퍼 바운디드 와일드카드 (0) | 2016.01.24 |
Type Inference 타입 인퍼런스 (0) | 2016.01.24 |
Generics, Inheritance, and Subtypes (0) | 2016.01.24 |
Generic Methods and Bounded Type Parameters (0) | 2016.01.24 |
댓글