Created
January 14, 2016 05:41
-
-
Save qrtt1/355b3bc920e441e0a5db to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package generic; | |
import java.util.ArrayList; | |
import java.util.List; | |
public class 阿嬤妳今嘛在叨位 { | |
static class 阿嬤 { | |
} | |
static class 淡水的阿嬤 extends 阿嬤 { | |
} | |
static class 恁祖媽 extends 淡水的阿嬤 { | |
} | |
public void lowerBoundedWildcard(List<? super 淡水的阿嬤> list) { | |
} | |
public void upperBoundedWildcard(List<? extends 淡水的阿嬤> list) { | |
} | |
public static void main(String[] args) { | |
阿嬤妳今嘛在叨位 operator = new 阿嬤妳今嘛在叨位(); | |
List<阿嬤> list1 = new ArrayList<阿嬤>(); | |
List<淡水的阿嬤> list2 = new ArrayList<淡水的阿嬤>(); | |
List<恁祖媽> list3 = new ArrayList<恁祖媽>(); | |
operator.lowerBoundedWildcard(list1); | |
operator.lowerBoundedWildcard(list2); | |
operator.lowerBoundedWildcard(list3); // compilation-error | |
operator.upperBoundedWildcard(list1); // compilation-error | |
operator.upperBoundedWildcard(list2); | |
operator.upperBoundedWildcard(list3); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment