freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內容

java編程基礎課程-300集史上最全、最深、最細(編輯修改稿)

2024-11-23 01:18 本頁面
 

【文章內容簡介】 E 等泛型字母為 有類型, 類型參數賦予具體的值 – ? 未知類型 類型參數賦予丌確定值 , 任意類型 ? 只能用在聲明類型 、方法參數上, 丌能用在定義泛型類上 ? 通配符 (代碼片段 ) //此處 T不能夠換成 ? public class StudentT { T score。 public static void main(String[] args) { //通配符 :用在聲明類型 Student? stu = new StudentString()。 test(new StudentInteger())。 } //通配符 :用在聲明方法參數 接收信息 public static void test(Student? stu){ //獲取信息 ()。 } } 上限 ? 上限 extends :指定的類型必須是繼承某個類,或者實現某個接口 (丌是用implements),即 =如 – ? extends Fruit – T extends List ? 丌能添加信息 ? 存在以下規(guī)則 ,如 – ListFruit 滿足 List? extends Fruit – List? extends Apple 滿足 List? extends Fruit – List?等同 List? extends Object public void test(List? extends Fruit list){ (new Fruit(“f))。 (new Pear(“p))。 (new Apple(“a))。 } 以上代碼無法通過編譯。為什么呢?? public class FooT extends List { public static void main(String[] args) { //上限 FooArrayList f =new FooArrayList。 FooLinkedList f2 =new FooLinkedList。 } } 下限 ? 下限 super:指定的類型丌能小于操作的類 ,即 = – T super Apple – ? super Apple ? 丌能添加父對象 ? 存在以下規(guī)則 ,如 – List? super Fruit 滿足 List? super Apple – ListFruit 滿足 List? super Fruit public void test(List? super Apple list){ (new Apple(“apple))。 (new FujiApple(“fuji))。 (new Fruit(“fruit”))。 } 以上代碼哪一行不能通過編譯。為什么呢?? 泛型嵌套 ? 稍微復雜一些,從外到內拆分 public class StudentT { T score。 } public static void main(String[] args) { //泛型的嵌套 BjsxtStudentString room =new BjsxtStudentString()。 //從外到內拆分 = new StudentString()。 StudentString stu = 。 String score =。 (score)。 } public class Bjsxt T{ T stu 。 } 其他 ? 泛型沒有多態(tài) ? 沒有泛型數組 ? jdk7簡化泛型 public class Jdk7{ public static void main(String[] args) { // ListString arrList= new ArrayListString()。 //,聲明類型即可,使用 |創(chuàng)建時不用指定類型 ListString arrList2= new ArrayList()。 } } public class OthersApp { public static void
點擊復制文檔內容
教學課件相關推薦
文庫吧 www.dybbs8.com
備案圖片鄂ICP備17016276號-1